Clean unused dependencies, minor refactorings

This commit is contained in:
Ilya Chernikov
2017-08-22 16:23:42 +02:00
parent 27968c8e13
commit 3e46c59187
29 changed files with 90 additions and 397 deletions
Generated
+1 -1
View File
@@ -1 +1 @@
kotlin kotlin gradle
+2 -15
View File
@@ -2,7 +2,6 @@ import org.gradle.api.Project
import java.util.* import java.util.*
import java.io.File import java.io.File
import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.java
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
@@ -31,8 +30,6 @@ buildscript {
} }
plugins { plugins {
// java // so we can benefit from the `java()` accessor below
// kotlin("jvm")
`build-scan` `build-scan`
} }
@@ -85,11 +82,6 @@ extra["JDK_16"] = jdkPath("1.6")
extra["JDK_17"] = jdkPath("1.7") extra["JDK_17"] = jdkPath("1.7")
extra["JDK_18"] = jdkPath("1.8") extra["JDK_18"] = jdkPath("1.8")
extra["compilerBaseName"] = "kotlin-compiler"
extra["embeddableCompilerBaseName"] = "kotlin-compiler-embeddable"
extra["buildLocalRepoPath"] = File(commonBuildDir, "repo")
extra["versions.protobuf-java"] = "2.6.1" extra["versions.protobuf-java"] = "2.6.1"
extra["versions.javax.inject"] = "1" extra["versions.javax.inject"] = "1"
extra["versions.jsr305"] = "1.3.9" extra["versions.jsr305"] = "1.3.9"
@@ -158,10 +150,6 @@ tasks.matching { task ->
// dependsOn(tasks.getByName(importedAntTasksPrefix + "update")) // dependsOn(tasks.getByName(importedAntTasksPrefix + "update"))
//} //}
//val prepareBootstrapTask = task("prepareBootstrap") {
// dependsOn(bootstrapCfg, scriptCompileCfg, scriptRuntimeCfg)
//}
fun Project.allprojectsRecursive(body: Project.() -> Unit) { fun Project.allprojectsRecursive(body: Project.() -> Unit) {
this.body() this.body()
this.subprojects { allprojectsRecursive(body) } this.subprojects { allprojectsRecursive(body) }
@@ -187,12 +175,11 @@ allprojects {
configureJvmProject(javaHome!!, jvmTarget!!) configureJvmProject(javaHome!!, jvmTarget!!)
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package", "-module-name", project.name) kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package")
// kotlinOptions.jvmTarget = "1.8"
} }
tasks.withType<Kotlin2JsCompile> { tasks.withType<Kotlin2JsCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package", "-module-name", project.name) kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package")
} }
tasks.withType<Javadoc> { tasks.withType<Javadoc> {
-2
View File
@@ -37,8 +37,6 @@ dependencies {
testRuntime(ideaSdkCoreDeps("*.jar")) testRuntime(ideaSdkCoreDeps("*.jar"))
testRuntime(ideaSdkDeps("*.jar")) testRuntime(ideaSdkDeps("*.jar"))
// testRuntime(project(":kotlin-compiler", configuration = "default")) // testRuntime(project(":kotlin-compiler", configuration = "default"))
buildVersion()
} }
sourceSets { sourceSets {
-2
View File
@@ -6,9 +6,7 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
buildVersion()
} }
sourceSets { sourceSets {
-2
View File
@@ -6,9 +6,7 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
dependencies { dependencies {
val compile by configurations
compile(ideaSdkDeps("asm-all")) compile(ideaSdkDeps("asm-all"))
buildVersion()
} }
sourceSets { sourceSets {
-1
View File
@@ -7,7 +7,6 @@ apply { plugin("kotlin") }
jvmTarget = "1.6" jvmTarget = "1.6"
dependencies { dependencies {
val compile by configurations
compile(project(":core:builtins")) compile(project(":core:builtins"))
compile(project("util.runtime")) compile(project("util.runtime"))
compile(protobufLite()) compile(protobufLite())
-1
View File
@@ -17,7 +17,6 @@ val builtinsSerialized = File(rootProject.extra["distDir"].toString(), "builtins
val builtins by configurations.creating val builtins by configurations.creating
dependencies { dependencies {
val compile by configurations
compile(protobufLite()) compile(protobufLite())
compile(files(builtinsSerialized)) compile(files(builtinsSerialized))
} }
-1
View File
@@ -22,7 +22,6 @@ apply {
jvmTarget = "1.6" jvmTarget = "1.6"
dependencies { dependencies {
val compile by configurations
compile(project(":core:builtins")) compile(project(":core:builtins"))
compile(project(":core")) compile(project(":core"))
compile(protobufLite()) compile(protobufLite())
-24
View File
@@ -1,24 +0,0 @@
import org.gradle.jvm.tasks.Jar
apply { plugin("kotlin") }
jvmTarget = "1.6"
dependencies {
val compile by configurations
compile(project(":core:builtins"))
compile(project(":kotlin-stdlib"))
buildVersion()
}
sourceSets {
"main" { projectDefault() }
"test" {}
}
tasks.withType<Jar> {
setupRuntimeJar("Kotlin Script Runtime")
archiveName = "kotlin-script-runtime.jar"
}
+1 -1
View File
@@ -1,3 +1,4 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
@@ -8,7 +9,6 @@ dependencies {
// compile(files(PathUtil.getJdkClassesRootsFromCurrentJre())) // TODO: make this one work instead of the nex one, since it contains more universal logic // compile(files(PathUtil.getJdkClassesRootsFromCurrentJre())) // TODO: make this one work instead of the nex one, since it contains more universal logic
compile(files("${System.getProperty("java.home")}/../lib/tools.jar")) compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
testCompile(project(":kotlin-test:kotlin-test-junit")) testCompile(project(":kotlin-test:kotlin-test-junit"))
buildVersion()
} }
sourceSets { sourceSets {
+36 -73
View File
@@ -50,6 +50,23 @@
"reporting": "org.gradle.api.reporting.ReportingExtension" "reporting": "org.gradle.api.reporting.ReportingExtension"
} }
}, },
":android-lint": {
"conventions": {
"base": "org.gradle.api.plugins.BasePluginConvention",
"java": "org.gradle.api.plugins.JavaPluginConvention"
},
"configurations": [
"archives",
"buildVersion",
"default",
"runtimeJar"
],
"extensions": {
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
"reporting": "org.gradle.api.reporting.ReportingExtension"
}
},
":compiler": { ":compiler": {
"conventions": { "conventions": {
"base": "org.gradle.api.plugins.BasePluginConvention", "base": "org.gradle.api.plugins.BasePluginConvention",
@@ -58,7 +75,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -176,7 +192,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -932,7 +947,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"buildVersion", "buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
@@ -1013,7 +1027,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"buildVersion", "buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
@@ -2339,42 +2352,6 @@
"shadow": "com.github.jengelman.gradle.plugins.shadow.ShadowExtension" "shadow": "com.github.jengelman.gradle.plugins.shadow.ShadowExtension"
} }
}, },
":core:script.runtime": {
"conventions": {
"base": "org.gradle.api.plugins.BasePluginConvention",
"java": "org.gradle.api.plugins.JavaPluginConvention"
},
"configurations": [
"apiElements",
"archives",
"build-version",
"compile",
"compileClasspath",
"compileOnly",
"default",
"implementation",
"kapt",
"kaptTest",
"runtime",
"runtimeClasspath",
"runtimeElements",
"runtimeOnly",
"testCompile",
"testCompileClasspath",
"testCompileOnly",
"testImplementation",
"testRuntime",
"testRuntimeClasspath",
"testRuntimeOnly"
],
"extensions": {
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
"kotlin": "org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension",
"kapt": "org.jetbrains.kotlin.gradle.plugin.KaptExtension",
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
"reporting": "org.gradle.api.reporting.ReportingExtension"
}
},
":core:util.runtime": { ":core:util.runtime": {
"conventions": { "conventions": {
"base": "org.gradle.api.plugins.BasePluginConvention", "base": "org.gradle.api.plugins.BasePluginConvention",
@@ -2783,7 +2760,7 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version", "buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -2794,6 +2771,7 @@
"runtime", "runtime",
"runtimeClasspath", "runtimeClasspath",
"runtimeElements", "runtimeElements",
"runtimeJar",
"runtimeOnly", "runtimeOnly",
"testCompile", "testCompile",
"testCompileClasspath", "testCompileClasspath",
@@ -3248,6 +3226,7 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3258,6 +3237,7 @@
"runtime", "runtime",
"runtimeClasspath", "runtimeClasspath",
"runtimeElements", "runtimeElements",
"runtimeJar",
"runtimeOnly", "runtimeOnly",
"testCompile", "testCompile",
"testCompileClasspath", "testCompileClasspath",
@@ -3283,6 +3263,7 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3293,6 +3274,7 @@
"runtime", "runtime",
"runtimeClasspath", "runtimeClasspath",
"runtimeElements", "runtimeElements",
"runtimeJar",
"runtimeOnly", "runtimeOnly",
"testCompile", "testCompile",
"testCompileClasspath", "testCompileClasspath",
@@ -3460,6 +3442,7 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3470,6 +3453,7 @@
"runtime", "runtime",
"runtimeClasspath", "runtimeClasspath",
"runtimeElements", "runtimeElements",
"runtimeJar",
"runtimeOnly", "runtimeOnly",
"testCompile", "testCompile",
"testCompileClasspath", "testCompileClasspath",
@@ -3531,6 +3515,7 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3541,6 +3526,7 @@
"runtime", "runtime",
"runtimeClasspath", "runtimeClasspath",
"runtimeElements", "runtimeElements",
"runtimeJar",
"runtimeOnly", "runtimeOnly",
"testCompile", "testCompile",
"testCompileClasspath", "testCompileClasspath",
@@ -3602,7 +3588,6 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"build-version",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3630,37 +3615,6 @@
"reporting": "org.gradle.api.reporting.ReportingExtension" "reporting": "org.gradle.api.reporting.ReportingExtension"
} }
}, },
":prepare:android-lint": {
"conventions": {
"base": "org.gradle.api.plugins.BasePluginConvention",
"java": "org.gradle.api.plugins.JavaPluginConvention"
},
"configurations": [
"apiElements",
"archives",
"compile",
"compileClasspath",
"compileOnly",
"default",
"implementation",
"runtime",
"runtimeClasspath",
"runtimeElements",
"runtimeOnly",
"testCompile",
"testCompileClasspath",
"testCompileOnly",
"testImplementation",
"testRuntime",
"testRuntimeClasspath",
"testRuntimeOnly"
],
"extensions": {
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
"reporting": "org.gradle.api.reporting.ReportingExtension"
}
},
":prepare:build.version": { ":prepare:build.version": {
"conventions": { "conventions": {
@@ -3680,6 +3634,7 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3688,6 +3643,7 @@
"runtime", "runtime",
"runtimeClasspath", "runtimeClasspath",
"runtimeElements", "runtimeElements",
"runtimeJar",
"runtimeOnly", "runtimeOnly",
"testCompile", "testCompile",
"testCompileClasspath", "testCompileClasspath",
@@ -3711,6 +3667,7 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3719,6 +3676,7 @@
"runtime", "runtime",
"runtimeClasspath", "runtimeClasspath",
"runtimeElements", "runtimeElements",
"runtimeJar",
"runtimeOnly", "runtimeOnly",
"testCompile", "testCompile",
"testCompileClasspath", "testCompileClasspath",
@@ -3739,7 +3697,10 @@
}, },
"configurations": [ "configurations": [
"archives",
"buildVersion",
"packedJars", "packedJars",
"runtimeJar",
"sideJars" "sideJars"
], ],
"extensions": { "extensions": {
@@ -3754,6 +3715,7 @@
"configurations": [ "configurations": [
"apiElements", "apiElements",
"archives", "archives",
"buildVersion",
"compile", "compile",
"compileClasspath", "compileClasspath",
"compileOnly", "compileOnly",
@@ -3764,6 +3726,7 @@
"runtime", "runtime",
"runtimeClasspath", "runtimeClasspath",
"runtimeElements", "runtimeElements",
"runtimeJar",
"runtimeOnly", "runtimeOnly",
"testCompile", "testCompile",
"testCompileClasspath", "testCompileClasspath",
+3 -7
View File
@@ -1,10 +1,9 @@
import org.gradle.jvm.tasks.Jar description = "Kotlin Gradle Tooling support"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
compile(ideaSdkDeps("gradle-tooling-api", compile(ideaSdkDeps("gradle-tooling-api",
@@ -13,7 +12,6 @@ dependencies {
"gradle-core", "gradle-core",
"gradle-base-services-groovy", "gradle-base-services-groovy",
subdir = "plugins/gradle/lib")) subdir = "plugins/gradle/lib"))
buildVersion()
} }
sourceSets { sourceSets {
@@ -21,8 +19,6 @@ sourceSets {
"test" {} "test" {}
} }
val jar: Jar by tasks runtimeJar()
ideaPlugin { ideaPlugin()
from(jar)
}
@@ -4,8 +4,6 @@ description = "Kotlin AllOpen Compiler Plugin"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compileOnly by configurations
val runtime by configurations
compileOnly(ideaSdkCoreDeps("intellij-core")) compileOnly(ideaSdkCoreDeps("intellij-core"))
compileOnly(project(":compiler:plugin-api")) compileOnly(project(":compiler:plugin-api"))
compileOnly(project(":compiler:frontend")) compileOnly(project(":compiler:frontend"))
+4 -7
View File
@@ -1,9 +1,9 @@
import org.gradle.jvm.tasks.Jar
description = "Kotlin AllOpen IDEA Plugin"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-allopen-compiler-plugin")) compile(project(":kotlin-allopen-compiler-plugin"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
@@ -22,10 +22,7 @@ sourceSets {
"test" {} "test" {}
} }
runtimeJar()
val jar: Jar by tasks ideaPlugin()
ideaPlugin {
from(jar)
}
@@ -1,15 +1,9 @@
import org.gradle.jvm.tasks.Jar description = "Kotlin Android Extensions IDEA"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
val compileOnly by configurations
val testCompile by configurations
val testCompileOnly by configurations
val testRuntime by configurations
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:light-classes")) compile(project(":compiler:light-classes"))
compile(project(":idea:idea-core")) compile(project(":idea:idea-core"))
@@ -54,8 +48,6 @@ projectTest {
workingDir = rootDir workingDir = rootDir
} }
val jar: Jar by tasks runtimeJar()
ideaPlugin { ideaPlugin()
from(jar)
}
+3 -7
View File
@@ -1,10 +1,9 @@
import org.gradle.jvm.tasks.Jar description = "Kotlin NoArg IDEA Plugin"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-noarg-compiler-plugin")) compile(project(":kotlin-noarg-compiler-plugin"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
@@ -25,9 +24,6 @@ sourceSets {
"test" {} "test" {}
} }
val jar: Jar by tasks runtimeJar()
ideaPlugin {
from(jar)
}
ideaPlugin()
@@ -4,8 +4,6 @@ description = "Kotlin SamWithReceiver Compiler Plugin"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compileOnly by configurations
val runtime by configurations
compileOnly(project(":compiler:frontend")) compileOnly(project(":compiler:frontend"))
compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":compiler:plugin-api")) compileOnly(project(":compiler:plugin-api"))
@@ -1,9 +1,9 @@
import org.gradle.jvm.tasks.Jar
description = "Kotlin SamWithReceiver IDEA Plugin"
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { dependencies {
val compile by configurations
compile(project(":kotlin-sam-with-receiver-compiler-plugin")) compile(project(":kotlin-sam-with-receiver-compiler-plugin"))
compile(project(":plugins:annotation-based-compiler-plugins-ide-support")) compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
compile(project(":compiler:util")) compile(project(":compiler:util"))
@@ -19,10 +19,7 @@ sourceSets {
"test" {} "test" {}
} }
runtimeJar()
val jar: Jar by tasks ideaPlugin()
ideaPlugin {
from(jar)
}
@@ -8,7 +8,6 @@ dependencies {
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
compile(project(":idea:ide-common")) compile(project(":idea:ide-common"))
compile(project(":plugins:uast-kotlin")) compile(project(":plugins:uast-kotlin"))
buildVersion()
} }
sourceSets { sourceSets {
+9 -15
View File
@@ -1,16 +1,19 @@
import org.gradle.jvm.tasks.Jar description = "Kotlin Android Lint"
apply { plugin("java") } apply { plugin("java-base") }
val projectsToShadow = listOf( val projectsToShadow = listOf(
":plugins:lint", ":plugins:lint",
":plugins:uast-kotlin", ":plugins:uast-kotlin",
":plugins:uast-kotlin-idea") ":plugins:uast-kotlin-idea")
tasks.withType<Jar> { sourceSets {
setupRuntimeJar("Kotlin Android Lint") "main" {}
archiveName = "android-lint.jar" "test" {}
}
runtimeJar {
projectsToShadow.forEach { projectsToShadow.forEach {
dependsOn("$it:classes") dependsOn("$it:classes")
project(it).let { p -> project(it).let { p ->
@@ -21,13 +24,4 @@ tasks.withType<Jar> {
} }
} }
sourceSets { ideaPlugin()
"main" {}
"test" {}
}
val jar: Jar by tasks
ideaPlugin {
from(jar)
}
@@ -30,7 +30,6 @@ val projectsToInclude = listOf(
":kotlin-daemon-client") ":kotlin-daemon-client")
dependencies { dependencies {
val testCompile by configurations
projectsToInclude.forEach { projectsToInclude.forEach {
jarContents(project(it)) { isTransitive = false } jarContents(project(it)) { isTransitive = false }
testCompile(project(it)) testCompile(project(it))
+4 -9
View File
@@ -33,11 +33,11 @@ val fatJar by configurations.creating
val compilerJar by configurations.creating val compilerJar by configurations.creating
val archives by configurations val archives by configurations
val compilerBaseName: String by rootProject.extra val compilerBaseName = name
val outputJar = File(buildDir, "libs", "$compilerBaseName.jar") val outputJar = File(buildDir, "libs", "$compilerBaseName.jar")
val javaHome = System.getProperty("java.home") val jreHome = System.getProperty("java.home")
val compilerModules: Array<String> by rootProject.extra val compilerModules: Array<String> by rootProject.extra
@@ -57,8 +57,8 @@ val ideaCoreSdkJars: Array<String> by rootProject.extra
val coreSdkJarsSimple = ideaCoreSdkJars.filterNot { it == "jdom" || it == "log4j" }.toTypedArray() val coreSdkJarsSimple = ideaCoreSdkJars.filterNot { it == "jdom" || it == "log4j" }.toTypedArray()
fun firstFromJavaHomeThatExists(vararg paths: String): File = fun firstFromJavaHomeThatExists(vararg paths: String): File =
paths.mapNotNull { File(javaHome, it).takeIf { it.exists() } }.firstOrNull() paths.mapNotNull { File(jreHome, it).takeIf { it.exists() } }.firstOrNull()
?: throw GradleException("Cannot find under '$javaHome' neither of: ${paths.joinToString()}") ?: throw GradleException("Cannot find under '$jreHome' neither of: ${paths.joinToString()}")
compilerModules.forEach { evaluationDependsOn(it) } compilerModules.forEach { evaluationDependsOn(it) }
@@ -73,7 +73,6 @@ dependencies {
compiledModulesSources.forEach { compiledModulesSources.forEach {
fatSourcesJarContents(it) fatSourcesJarContents(it)
} }
// buildVersion()
fatJarContents(project(":core:builtins", configuration = "builtins")) fatJarContents(project(":core:builtins", configuration = "builtins"))
fatJarContents(ideaSdkCoreDeps(*coreSdkJarsSimple)) fatJarContents(ideaSdkCoreDeps(*coreSdkJarsSimple))
@@ -93,10 +92,6 @@ dependencies {
proguardLibraryJars(project(":kotlin-script-runtime", configuration = "mainJar")) proguardLibraryJars(project(":kotlin-script-runtime", configuration = "mainJar"))
proguardLibraryJars(project(":kotlin-reflect", configuration = "mainJar")) proguardLibraryJars(project(":kotlin-reflect", configuration = "mainJar"))
proguardLibraryJars(preloadedDeps("kotlinx-coroutines-core")) proguardLibraryJars(preloadedDeps("kotlinx-coroutines-core"))
// proguardLibraryJars(project(":prepare:runtime", configuration = "default").apply { isTransitive = false })
// proguardLibraryJars(project(":prepare:reflect", configuration = "default").apply { isTransitive = false })
// proguardLibraryJars(project(":core:script.runtime").apply { isTransitive = false })
} }
val packCompiler by task<ShadowJar> { val packCompiler by task<ShadowJar> {
+2 -3
View File
@@ -1,10 +1,9 @@
import org.gradle.jvm.tasks.Jar description = "Kotlin Formatter"
apply { plugin("java") } apply { plugin("java") }
tasks.withType<Jar> { runtimeJar {
setupRuntimeJar("Kotlin Formatter")
archiveName = "kotlin-formatter.jar" archiveName = "kotlin-formatter.jar"
dependsOn(":idea:formatter:classes") dependsOn(":idea:formatter:classes")
project(":idea:formatter").let { p -> project(":idea:formatter").let { p ->
+2 -3
View File
@@ -1,10 +1,9 @@
import org.gradle.jvm.tasks.Jar description = "Kotlin IDE Lazy Resolver"
apply { plugin("java") } apply { plugin("java") }
tasks.withType<Jar> { runtimeJar {
setupRuntimeJar("Kotlin IDE Lazy Resolver")
archiveName = "kotlin-ide-common.jar" archiveName = "kotlin-ide-common.jar"
dependsOn(":idea:ide-common:classes") dependsOn(":idea:ide-common:classes")
project(":idea:ide-common").let { p -> project(":idea:ide-common").let { p ->
+4 -8
View File
@@ -1,6 +1,8 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
description = "Kotlin IDEA plugin"
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
@@ -60,11 +62,7 @@ dependencies {
sideJars(preloadedDeps("markdown", "kotlinx-coroutines-core", "kotlinx-coroutines-jdk8")) sideJars(preloadedDeps("markdown", "kotlinx-coroutines-core", "kotlinx-coroutines-jdk8"))
} }
val targetJar = File(buildDir, "libs", "kotlin-plugin.jar") val jar = runtimeJar(task<ShadowJar>("shadowJar")) {
val shadowTask = task<ShadowJar>("shadowJar") {
setupRuntimeJar("Kotlin IDEA plugin")
archiveName = targetJar.canonicalPath
projectsToShadow.forEach { projectsToShadow.forEach {
dependsOn("$it:classes") dependsOn("$it:classes")
project(it).let { p -> project(it).let { p ->
@@ -78,9 +76,7 @@ val shadowTask = task<ShadowJar>("shadowJar") {
} }
ideaPlugin { ideaPlugin {
dependsOn(shadowTask) from(jar)
from(targetJar)
dependsOn(":kotlin-script-runtime:jar")
from(sideJars) from(sideJars)
} }
+10 -19
View File
@@ -1,21 +1,13 @@
import org.gradle.jvm.tasks.Jar description = "Kotlin Mock Runtime for Tests"
import org.gradle.api.internal.HasConvention
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
apply { plugin("kotlin") } apply { plugin("kotlin") }
dependencies { jvmTarget = "1.6"
val compile by configurations javaHome = rootProject.extra["JDK_16"] as String
compile(project(":kotlin-stdlib"))
}
val jar: Jar by tasks dependencies {
jar.apply { compile(project(":kotlin-stdlib"))
setupRuntimeJar("Kotlin Mock Runtime for Tests")
from(fileTree("${rootProject.extra["distDir"]}/builtins")) { include("kotlin/**") }
archiveName = "kotlin-mock-runtime-for-test.jar"
} }
sourceSets { sourceSets {
@@ -38,17 +30,16 @@ sourceSets {
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
sourceCompatibility = "1.6" sourceCompatibility = "1.6"
targetCompatibility = "1.6" targetCompatibility = "1.6"
// options.fork = true
options.forkOptions.javaHome = file(rootProject.extra["JDK_16"] as String)
} }
tasks.withType<KotlinCompile> { val jar = runtimeJar {
kotlinOptions.jvmTarget = "1.6" from(fileTree("${rootProject.extra["distDir"]}/builtins")) { include("kotlin/**") }
kotlinOptions.jdkHome = rootProject.extra["JDK_16"] as String archiveName = "kotlin-mock-runtime-for-test.jar"
} }
task<Copy>("dist") { task<Copy>("dist") {
into(rootProject.extra["distDir"].toString())
from(jar) from(jar)
into(rootProject.extra["distDir"].toString())
rename("-${Regex.escape(rootProject.extra["build.number"].toString())}", "")
} }
-131
View File
@@ -1,131 +0,0 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.jetbrains.org.objectweb.asm.*
import org.gradle.jvm.tasks.Jar
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.util.jar.JarFile
import java.util.zip.ZipOutputStream
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
classpath(ideaSdkDeps("asm-all"))
}
}
apply { plugin("com.github.johnrengelman.shadow") }
// Set to false to prevent relocation and metadata stripping on kotlin-reflect.jar and reflection sources. Use to debug reflection
val obfuscateReflect = true
val classesFromProjectsCfg = configurations.create("classes-from-projects")
val otherDepsCfg = configurations.create("other-deps")
val mainCfg = configurations.create("default")
val outputReflectJarFileBase = "$buildDir/libs/kotlin-reflect"
val coreProjectName = ":core"
val reflectionProjectName = ":core:reflection.jvm"
artifacts.add(mainCfg.name, File(outputReflectJarFileBase + ".jar"))
dependencies {
classesFromProjectsCfg.name(projectDepIntransitive(coreProjectName))
classesFromProjectsCfg.name(projectDepIntransitive(":core:util.runtime"))
classesFromProjectsCfg.name(projectDepIntransitive(reflectionProjectName))
otherDepsCfg.name(protobufLite())
otherDepsCfg.name(commonDep("javax.inject"))
buildVersion()
}
val prePackReflectTask = task<ShadowJar>("pre-pack-reflect") {
classifier = if (obfuscateReflect) outputReflectJarFileBase + "_beforeStrip" else outputReflectJarFileBase
configurations = listOf(mainCfg)
setupRuntimeJar("Kotlin Reflect")
dependsOn("$coreProjectName:assemble", "$reflectionProjectName:assemble", protobufLiteTask)
from(project(reflectionProjectName).getCompiledClasses())
from(project(coreProjectName).getCompiledClasses())
from(project(":core:util.runtime").getCompiledClasses())
from(project(coreProjectName).file("descriptor.loader.java/src")) {
include("META-INF/services/**")
}
from(otherDepsCfg.files)
manifest.attributes.put("Class-Path", "kotlin-runtime.jar")
if (obfuscateReflect) {
relocate("org.jetbrains.kotlin", "kotlin.reflect.jvm.internal.impl")
relocate("javax.inject", "kotlin.reflect.jvm.internal.impl.javax.inject")
}
}
val mainTask = task("prepare") {
dependsOn(prePackReflectTask)
val inFile = File(outputReflectJarFileBase + "_beforeStrip.jar")
val outFile = File(outputReflectJarFileBase + ".jar")
inputs.file(inFile)
outputs.file(outFile)
val annotationRegex = "kotlin/Metadata".toRegex()
val classRegex = "kotlin/reflect/jvm/internal/impl/.*".toRegex()
doLast {
println("Stripping annotations from all classes in $inFile")
println("Input file size: ${inFile.length()} bytes")
fun transform(entryName: String, bytes: ByteArray): ByteArray {
if (!entryName.endsWith(".class")) return bytes
if (!classRegex.matches(entryName.removeSuffix(".class"))) return bytes
var changed = false
val classWriter = ClassWriter(0)
val classVisitor = object : ClassVisitor(Opcodes.ASM5, classWriter) {
override fun visitAnnotation(desc: String, visible: Boolean): AnnotationVisitor? {
if (annotationRegex.matches(Type.getType(desc).internalName)) {
changed = true
return null
}
return super.visitAnnotation(desc, visible)
}
}
ClassReader(bytes).accept(classVisitor, 0)
if (!changed) return bytes
return classWriter.toByteArray()
}
ZipOutputStream(BufferedOutputStream(FileOutputStream(outFile))).use { outJar ->
val inJar = JarFile(inFile)
try {
for (entry in inJar.entries()) {
if (entry.isDirectory) continue
val inBytes = inJar.getInputStream(entry).readBytes()
val outBytes = transform(entry.name, inBytes)
if (inBytes.size < outBytes.size) {
error("Size increased for ${entry.name}: was ${inBytes.size} bytes, became ${outBytes.size} bytes")
}
entry.compressedSize = -1L
outJar.putNextEntry(entry)
outJar.write(outBytes)
outJar.closeEntry()
}
}
finally {
// Yes, JarFile does not extend Closeable on JDK 6 so we can't use "use" here
inJar.close()
}
}
println("Output written to $outFile")
println("Output file size: ${outFile.length()} bytes")
}
}
defaultTasks(mainTask.name)
-39
View File
@@ -1,39 +0,0 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import java.io.File
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
classpath(ideaSdkDeps("asm-all"))
}
}
apply { plugin("com.github.johnrengelman.shadow") }
val mainCfg = configurations.create("default")
val outputRuntimeJarFileBase = "$buildDir/libs/kotlin-runtime"
artifacts.add(mainCfg.name, File(outputRuntimeJarFileBase + ".jar"))
dependencies {
mainCfg.name(projectDepIntransitive(":core:builtins"))
mainCfg.name(projectDepIntransitive(":kotlin-stdlib"))
buildVersion()
}
val mainTask = task<ShadowJar>("prepare") {
classifier = outputRuntimeJarFileBase
configurations = listOf(mainCfg)
dependsOn(":core:builtins:assemble", ":kotlin-stdlib:assemble")
setupRuntimeJar("Kotlin Runtime")
from(mainCfg.files)
}
defaultTasks(mainTask.name)
+2 -2
View File
@@ -50,7 +50,6 @@ include ":kotlin-build-common",
":core", ":core",
":core:builtins", ":core:builtins",
":core:reflection.jvm", ":core:reflection.jvm",
":core:script.runtime",
":core:util.runtime", ":core:util.runtime",
":custom-dependencies:protobuf-lite", ":custom-dependencies:protobuf-lite",
":idea:idea-jps-common", ":idea:idea-jps-common",
@@ -97,7 +96,7 @@ include ":kotlin-build-common",
":prepare:formatter", ":prepare:formatter",
":prepare:ide-lazy-resolver", ":prepare:ide-lazy-resolver",
":prepare:kotlin-plugin", ":prepare:kotlin-plugin",
":prepare:android-lint", ":android-lint",
":prepare:mock-runtime-for-test", ":prepare:mock-runtime-for-test",
":kotlin-compiler", ":kotlin-compiler",
":kotlin-compiler-embeddable", ":kotlin-compiler-embeddable",
@@ -157,6 +156,7 @@ project(':idea:idea-android-output-parser').projectDir = "$rootDir/idea/idea-and
project(':android-extensions-compiler').projectDir = "$rootDir/plugins/android-extensions/android-extensions-compiler" as File project(':android-extensions-compiler').projectDir = "$rootDir/plugins/android-extensions/android-extensions-compiler" as File
project(':plugins:android-extensions-idea').projectDir = "$rootDir/plugins/android-extensions/android-extensions-idea" as File project(':plugins:android-extensions-idea').projectDir = "$rootDir/plugins/android-extensions/android-extensions-idea" as File
project(':plugins:android-extensions-jps').projectDir = "$rootDir/plugins/android-extensions/android-extensions-jps" as File project(':plugins:android-extensions-jps').projectDir = "$rootDir/plugins/android-extensions/android-extensions-jps" as File
project(':android-lint').projectDir = "$rootDir/prepare/android-lint" as File
project(':kotlin-allopen-compiler-plugin').projectDir = "$rootDir/plugins/allopen/allopen-cli" as File project(':kotlin-allopen-compiler-plugin').projectDir = "$rootDir/plugins/allopen/allopen-cli" as File
project(':plugins:allopen-ide').projectDir = "$rootDir/plugins/allopen/allopen-ide" as File project(':plugins:allopen-ide').projectDir = "$rootDir/plugins/allopen/allopen-ide" as File
project(':kotlin-noarg-compiler-plugin').projectDir = "$rootDir/plugins/noarg/noarg-cli" as File project(':kotlin-noarg-compiler-plugin').projectDir = "$rootDir/plugins/noarg/noarg-cli" as File