From b6c255cea57e39a1e56a792fe7d1b982eb196270 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Mon, 11 Sep 2017 14:47:07 +0200 Subject: [PATCH] Refactor: project renaming, using improved build dsl --- ant/build.gradle.kts | 4 +- build-common/build.gradle.kts | 30 ++-- build.gradle.kts | 6 +- compiler/build.gradle.kts | 2 +- compiler/cli/cli-runner/build.gradle.kts | 2 +- compiler/compiler-runner/build.gradle.kts | 2 +- .../daemon/daemon-client/build.gradle.kts | 18 +-- .../build.gradle.kts | 2 +- generators/build.gradle.kts | 2 +- gradle/project-schema.json | 149 +++++++++++++----- jps-plugin/build.gradle.kts | 46 +++--- .../build.gradle.kts | 12 +- .../build.gradle.kts | 11 +- .../build.gradle | 2 +- .../tools/kotlin-gradle-plugin/build.gradle | 4 +- plugins/allopen/allopen-cli/build.gradle.kts | 2 +- .../build.gradle.kts | 2 +- .../sam-with-receiver-cli/build.gradle.kts | 2 +- .../source-sections-compiler/build.gradle.kts | 19 +-- prepare/build.version/build.gradle.kts | 17 +- prepare/daemon-client/build.gradle.kts | 31 ---- prepare/jps-plugin/build.gradle.kts | 52 +++--- prepare/kotlin-plugin/build.gradle.kts | 2 +- settings.gradle | 7 +- 24 files changed, 209 insertions(+), 217 deletions(-) delete mode 100644 prepare/daemon-client/build.gradle.kts diff --git a/ant/build.gradle.kts b/ant/build.gradle.kts index a89a603efe7..f507c495a40 100644 --- a/ant/build.gradle.kts +++ b/ant/build.gradle.kts @@ -4,15 +4,13 @@ description = "Kotlin Ant Tools" apply { plugin("kotlin") } dependencies { - val compile by configurations compile(commonDep("org.apache.ant", "ant")) compile(project(":kotlin-preloader")) compile(project(":kotlin-stdlib")) - buildVersion() } sourceSets { - "main" { default() } + "main" { projectDefault() } "test" { none() } } diff --git a/build-common/build.gradle.kts b/build-common/build.gradle.kts index 69f2e647d01..5fc8ffe93e1 100644 --- a/build-common/build.gradle.kts +++ b/build-common/build.gradle.kts @@ -1,40 +1,28 @@ -import org.gradle.jvm.tasks.Jar +description = "Kotlin Build Common" apply { plugin("kotlin") } dependencies { - val compile by configurations - val compileOnly by configurations - val testCompile by configurations - val testCompileOnly by configurations - val testRuntime by configurations compile(project(":core:util.runtime")) compile(project(":compiler:util")) compile(project(":compiler:cli-common")) compile(project(":compiler:frontend.java")) compile(ideaSdkDeps("util")) - buildVersion() testCompile(commonDep("junit:junit")) testCompile(project(":compiler.tests-common")) testCompile(protobufFull()) + testRuntime(project(":kotlin-stdlib")) + testRuntime(project(":kotlin-reflect")) } -configureKotlinProjectSourcesDefault() -configureKotlinProjectTestsDefault() - -val jar: Jar by tasks -jar.apply { - setupRuntimeJar("Kotlin Build Common") - baseName = "kotlin-build-common" +sourceSets { + "main" { projectDefault() } + "test" { projectDefault() } } -testsJar {} +runtimeJar() -tasks.withType { - workingDir = rootDir - systemProperty("idea.is.unit.test", "true") - systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true") - ignoreFailures = true -} +testsJar() +projectTest() diff --git a/build.gradle.kts b/build.gradle.kts index 3c889ad9409..ce4966deee3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -119,7 +119,7 @@ extra["compilerModules"] = arrayOf(":compiler:util", ":js:js.translator", ":js:js.dce", ":compiler", - ":build-common", + ":kotlin-build-common", ":core:util.runtime", ":core") @@ -186,6 +186,10 @@ allprojects { task("javadocJar") { classifier = "javadoc" } + + tasks.withType { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } } task("dist") { diff --git a/compiler/build.gradle.kts b/compiler/build.gradle.kts index 2c0c6754aa5..f9102ecdbe5 100644 --- a/compiler/build.gradle.kts +++ b/compiler/build.gradle.kts @@ -10,7 +10,7 @@ dependencies { compileOnly(project(":compiler:cli")) compileOnly(project(":compiler:daemon-common")) compileOnly(project(":compiler:incremental-compilation-impl")) - compileOnly(project(":build-common")) + compileOnly(project(":kotlin-build-common")) compileOnly(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array))) compileOnly(commonDep("org.fusesource.jansi", "jansi")) compileOnly(commonDep("org.jline", "jline")) diff --git a/compiler/cli/cli-runner/build.gradle.kts b/compiler/cli/cli-runner/build.gradle.kts index 6558287c135..7e20a41b541 100644 --- a/compiler/cli/cli-runner/build.gradle.kts +++ b/compiler/cli/cli-runner/build.gradle.kts @@ -10,7 +10,7 @@ dependencies { } sourceSets { - "main" { default() } + "main" { projectDefault() } "test" { none() } } diff --git a/compiler/compiler-runner/build.gradle.kts b/compiler/compiler-runner/build.gradle.kts index eb75c29a059..0b497f056e8 100644 --- a/compiler/compiler-runner/build.gradle.kts +++ b/compiler/compiler-runner/build.gradle.kts @@ -3,7 +3,7 @@ apply { plugin("kotlin") } dependencies { val compile by configurations - compile(project(":build-common")) + compile(project(":kotlin-build-common")) compile(project(":compiler:cli-common")) compile(project(":kotlin-preloader")) compile(project(":compiler:frontend.java")) diff --git a/compiler/daemon/daemon-client/build.gradle.kts b/compiler/daemon/daemon-client/build.gradle.kts index fb38a395be1..33a63565f31 100644 --- a/compiler/daemon/daemon-client/build.gradle.kts +++ b/compiler/daemon/daemon-client/build.gradle.kts @@ -3,24 +3,24 @@ description = "Kotlin Daemon Client" apply { plugin("kotlin") } -val nativePlatformUberjar = "$rootDir/dependencies/native-platform-uberjar.jar" +val nativePlatformUberjar = preloadedDeps("native-platform-uberjar") dependencies { - val compile by configurations - compile(project(":compiler:util")) - compile(project(":compiler:cli-common")) - compile(project(":compiler:daemon-common")) - compile(files(nativePlatformUberjar)) - buildVersion() + compileOnly(project(":compiler:util")) + compileOnly(project(":compiler:cli-common")) + compileOnly(project(":compiler:daemon-common")) + compileOnly(nativePlatformUberjar) } sourceSets { - "main" { default() } + "main" { projectDefault() } "test" { none() } } runtimeJar { - from(zipTree(nativePlatformUberjar)) + nativePlatformUberjar.forEach { + from(zipTree(it)) + } } sourcesJar() diff --git a/compiler/incremental-compilation-impl/build.gradle.kts b/compiler/incremental-compilation-impl/build.gradle.kts index 962c47f7f82..f829bb4d435 100644 --- a/compiler/incremental-compilation-impl/build.gradle.kts +++ b/compiler/incremental-compilation-impl/build.gradle.kts @@ -8,7 +8,7 @@ dependencies { compile(project(":compiler:frontend")) compile(project(":compiler:frontend.java")) compile(project(":compiler:cli")) - compile(project(":build-common")) + compile(project(":kotlin-build-common")) } configureKotlinProjectSourcesDefault() diff --git a/generators/build.gradle.kts b/generators/build.gradle.kts index 38a6db59245..b7ff8ad51a9 100644 --- a/generators/build.gradle.kts +++ b/generators/build.gradle.kts @@ -22,7 +22,7 @@ dependencies { compile(project(":js:js.frontend")) compile(project(":idea:idea-test-framework")) compile(project(":kotlin-test:kotlin-test-jvm")) - compile(projectTests(":build-common")) + compile(projectTests(":kotlin-build-common")) compile(projectTests(":compiler")) compile(projectTests(":compiler:tests-java8")) compile(projectTests(":compiler:container")) diff --git a/gradle/project-schema.json b/gradle/project-schema.json index 312bc858f99..a40ce09cfcf 100644 --- a/gradle/project-schema.json +++ b/gradle/project-schema.json @@ -48,43 +48,6 @@ "reporting": "org.gradle.api.reporting.ReportingExtension" } }, - ":build-common": { - "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", - "tests-jar" - ], - "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" - } - }, ":compiler": { "conventions": { "base": "org.gradle.api.plugins.BasePluginConvention", @@ -525,7 +488,6 @@ "configurations": [ "apiElements", "archives", - "build-version", "compile", "compileClasspath", "compileOnly", @@ -554,6 +516,43 @@ "reporting": "org.gradle.api.reporting.ReportingExtension" } }, + ":kotlin-build-common": { + "conventions": { + "base": "org.gradle.api.plugins.BasePluginConvention", + "java": "org.gradle.api.plugins.JavaPluginConvention" + }, + "configurations": [ + "apiElements", + "archives", + "compile", + "compileClasspath", + "compileOnly", + "default", + "implementation", + "kapt", + "kaptTest", + "runtime", + "runtimeClasspath", + "runtimeElements", + "runtimeJar", + "runtimeOnly", + "testCompile", + "testCompileClasspath", + "testCompileOnly", + "testImplementation", + "testRuntime", + "testRuntimeClasspath", + "testRuntimeOnly", + "tests-jar" + ], + "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" + } + }, ":kotlin-compiler": { "conventions": { "base": "org.gradle.api.plugins.BasePluginConvention", @@ -1174,7 +1173,8 @@ ":kotlin-script-util": { "conventions": { "base": "org.gradle.api.plugins.BasePluginConvention", - "java": "org.gradle.api.plugins.JavaPluginConvention" + "java": "org.gradle.api.plugins.JavaPluginConvention", + "maven": "org.gradle.api.plugins.MavenPluginConvention" }, "configurations": [ "apiElements", @@ -1189,6 +1189,7 @@ "runtime", "runtimeClasspath", "runtimeElements", + "runtimeJar", "runtimeOnly", "testCompile", "testCompileClasspath", @@ -2429,6 +2430,76 @@ "reporting": "org.gradle.api.reporting.ReportingExtension" } }, + ":examples:kotlin-jsr223-daemon-local-eval-example": { + "conventions": { + "base": "org.gradle.api.plugins.BasePluginConvention", + "java": "org.gradle.api.plugins.JavaPluginConvention" + }, + "configurations": [ + "apiElements", + "archives", + "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" + } + }, + ":examples:kotlin-jsr223-local-example": { + "conventions": { + "base": "org.gradle.api.plugins.BasePluginConvention", + "java": "org.gradle.api.plugins.JavaPluginConvention" + }, + "configurations": [ + "apiElements", + "archives", + "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" + } + }, ":idea:formatter": { "conventions": { "base": "org.gradle.api.plugins.BasePluginConvention", diff --git a/jps-plugin/build.gradle.kts b/jps-plugin/build.gradle.kts index 974969c6b80..347ec690e4d 100644 --- a/jps-plugin/build.gradle.kts +++ b/jps-plugin/build.gradle.kts @@ -1,18 +1,9 @@ -apply { - plugin("kotlin") -} +apply { plugin("kotlin") } + +val compilerModules: Array by rootProject.extra dependencies { - val compile by configurations - val compileOnly by configurations - val testCompile by configurations - val testCompileOnly by configurations - val testRuntime by configurations - testRuntime(ideaSdkCoreDeps("*.jar")) - testRuntime(ideaSdkDeps("*.jar")) - testRuntime(ideaSdkDeps("*.jar", subdir = "jps/test")) - testRuntime(ideaSdkDeps("*.jar", subdir = "jps")) - compile(project(":build-common")) + compile(project(":kotlin-build-common")) compile(project(":core")) compile(project(":compiler:compiler-runner")) compile(project(":compiler:daemon-common")) @@ -21,31 +12,30 @@ dependencies { compile(project(":kotlin-preloader")) compile(project(":idea:idea-jps-common")) compile(ideaSdkDeps("jps-builders", "jps-builders-6", subdir = "jps")) - buildVersion() testCompile(project(":compiler.tests-common")) testCompile(project(":compiler:incremental-compilation-impl")) testCompileOnly(ideaSdkDeps("jps-build-test", subdir = "jps/test")) testCompile(commonDep("junit:junit")) testCompile(project(":kotlin-test:kotlin-test-jvm")) - testCompile(projectTests(":build-common")) - (rootProject.extra["compilerModules"] as Array).forEach { + testCompile(projectTests(":kotlin-build-common")) + compilerModules.forEach { testRuntime(project(it)) } + testRuntime(ideaSdkCoreDeps("*.jar")) + testRuntime(ideaSdkDeps("*.jar")) + testRuntime(ideaSdkDeps("*.jar", subdir = "jps/test")) + testRuntime(ideaSdkDeps("*.jar", subdir = "jps")) +} + +sourceSets { + "main" { projectDefault() } + "test" { + java.srcDirs("jps-tests/test") + } } -configureKotlinProjectSourcesDefault() -configureKotlinProjectResourcesDefault() -configureKotlinProjectTests("test", sourcesBaseDir = File(projectDir, "jps-tests")) -configureKotlinProjectTestResources("testData") - - -tasks.withType { - jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true") - maxHeapSize = "1200m" +projectTest { workingDir = rootDir - systemProperty("idea.is.unit.test", "true") - forkEvery = 100 - ignoreFailures = true } testsJar {} diff --git a/libraries/examples/kotlin-jsr223-daemon-local-eval-example/build.gradle.kts b/libraries/examples/kotlin-jsr223-daemon-local-eval-example/build.gradle.kts index b3bcb568fa5..bc3bf61b571 100644 --- a/libraries/examples/kotlin-jsr223-daemon-local-eval-example/build.gradle.kts +++ b/libraries/examples/kotlin-jsr223-daemon-local-eval-example/build.gradle.kts @@ -4,9 +4,6 @@ description = "Sample Kotlin JSR 223 scripting jar with daemon (out-of-process) apply { plugin("kotlin") } dependencies { - val compile by configurations - val testCompile by configurations - val testRuntime by configurations compile(project(":kotlin-stdlib")) compile(project(":kotlin-script-runtime")) compile(projectRuntimeJar(":kotlin-compiler")) @@ -16,11 +13,4 @@ dependencies { testRuntime(project(":kotlin-reflect")) } -tasks.withType { - jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true") - maxHeapSize = "1200m" - systemProperty("idea.is.unit.test", "true") - environment("NO_FS_ROOTS_ACCESS_CHECK", "true") - environment("KOTLIN_HOME", rootProject.extra["distKotlinHomeDir"]) - ignoreFailures = true -} +projectTest() diff --git a/libraries/examples/kotlin-jsr223-local-example/build.gradle.kts b/libraries/examples/kotlin-jsr223-local-example/build.gradle.kts index 9c9aa261d0e..47b45cf2559 100644 --- a/libraries/examples/kotlin-jsr223-local-example/build.gradle.kts +++ b/libraries/examples/kotlin-jsr223-local-example/build.gradle.kts @@ -4,9 +4,6 @@ description = "Sample Kotlin JSR 223 scripting jar with local (in-process) compi apply { plugin("kotlin") } dependencies { - val compile by configurations - val testCompile by configurations - val testRuntime by configurations compile(project(":kotlin-stdlib")) compile(project(":kotlin-script-runtime")) compile(projectRuntimeJar(":kotlin-compiler")) @@ -15,10 +12,4 @@ dependencies { testRuntime(project(":kotlin-reflect")) } -tasks.withType { - jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1200m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true") - maxHeapSize = "1200m" - systemProperty("idea.is.unit.test", "true") - environment("NO_FS_ROOTS_ACCESS_CHECK", "true") - ignoreFailures = true -} +projectTest() diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle index d136daf7f17..a999e7b6a3f 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle @@ -17,7 +17,7 @@ dependencies { testCompile project(path: ':examples:annotation-processor-example') testCompile project(':kotlin-stdlib-jre8') testCompile project(':android-extensions-compiler') - testCompile project(path: ':build-common', configuration: 'tests-jar') + testCompile project(path: ':kotlin-build-common', configuration: 'tests-jar') testCompile 'org.jetbrains.kotlin:gradle-api:2.2' } diff --git a/libraries/tools/kotlin-gradle-plugin/build.gradle b/libraries/tools/kotlin-gradle-plugin/build.gradle index 1a6fb1bcc9f..e18119657ea 100644 --- a/libraries/tools/kotlin-gradle-plugin/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin/build.gradle @@ -32,7 +32,7 @@ dependencies { compile project(':kotlin-stdlib') compile project(':android-extensions-compiler') // compile project(path: ':compiler', configuration: 'embeddableCompilerJar') - compile project(':build-common') + compile project(':kotlin-build-common') compile project(':compiler:compiler-runner') compile project(":compiler:incremental-compilation-impl") compile project(":compiler") @@ -46,7 +46,7 @@ dependencies { agp25CompileOnly 'org.codehaus.groovy:groovy-all:2.3.9' agp25CompileOnly gradleApi() - testCompile project (path: ':build-common', configuration: 'tests-jar') + testCompile project (path: ':kotlin-build-common', configuration: 'tests-jar') testCompile project(':kotlin-test::kotlin-test-junit') testCompile "junit:junit:4.12" } diff --git a/plugins/allopen/allopen-cli/build.gradle.kts b/plugins/allopen/allopen-cli/build.gradle.kts index aaf14b15c28..b8c0d1468a7 100644 --- a/plugins/allopen/allopen-cli/build.gradle.kts +++ b/plugins/allopen/allopen-cli/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { } sourceSets { - "main" { default() } + "main" { projectDefault() } "test" { none() } } diff --git a/plugins/android-extensions/android-extensions-compiler/build.gradle.kts b/plugins/android-extensions/android-extensions-compiler/build.gradle.kts index e5d81f4e917..03bbffc04b6 100644 --- a/plugins/android-extensions/android-extensions-compiler/build.gradle.kts +++ b/plugins/android-extensions/android-extensions-compiler/build.gradle.kts @@ -20,7 +20,7 @@ configureKotlinProjectNoTests() sourceSets { "main" { - default() + projectDefault() java.srcDir("../android-extensions-runtime/src") } "test" { none() } diff --git a/plugins/sam-with-receiver/sam-with-receiver-cli/build.gradle.kts b/plugins/sam-with-receiver/sam-with-receiver-cli/build.gradle.kts index 02ab8c9b318..aa115c04016 100644 --- a/plugins/sam-with-receiver/sam-with-receiver-cli/build.gradle.kts +++ b/plugins/sam-with-receiver/sam-with-receiver-cli/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { } sourceSets { - "main" { default() } + "main" { projectDefault() } "test" { none() } } diff --git a/plugins/source-sections/source-sections-compiler/build.gradle.kts b/plugins/source-sections/source-sections-compiler/build.gradle.kts index 882f866ab65..93c2fbe6bc7 100644 --- a/plugins/source-sections/source-sections-compiler/build.gradle.kts +++ b/plugins/source-sections/source-sections-compiler/build.gradle.kts @@ -4,11 +4,6 @@ description = "Kotlin SourceSections Compiler Plugin" apply { plugin("kotlin") } dependencies { - val compile by configurations - val compileOnly by configurations - val testCompile by configurations - val testCompileOnly by configurations - val testRuntime by configurations compileOnly(project(":compiler:frontend")) compileOnly(project(":compiler:frontend.script")) compileOnly(project(":compiler:plugin-api")) @@ -16,7 +11,6 @@ dependencies { testCompile(project(":compiler:frontend.script")) testCompile(project(":compiler:plugin-api")) testCompile(project(":compiler.tests-common")) - testCompile(commonDep("junit:junit")) testCompile(project(":compiler:util")) testCompile(project(":compiler:cli")) testCompile(project(":compiler:cli-common")) @@ -26,18 +20,11 @@ dependencies { } sourceSets { - "main" { default() } - "test" { default() } + "main" { projectDefault() } + "test" { projectDefault() } } -tasks.withType { - dependsOnTaskIfExistsRec("dist", project = rootProject) - workingDir = rootDir - systemProperty("idea.is.unit.test", "true") - environment("NO_FS_ROOTS_ACCESS_CHECK", "true") - environment("KOTLIN_HOME", rootProject.extra["distKotlinHomeDir"]) - ignoreFailures = true -} +projectTest() runtimeJar() sourcesJar() diff --git a/prepare/build.version/build.gradle.kts b/prepare/build.version/build.gradle.kts index 41f4c3c9e86..2f2d090048f 100644 --- a/prepare/build.version/build.gradle.kts +++ b/prepare/build.version/build.gradle.kts @@ -3,18 +3,16 @@ import java.io.File val buildVersionFilePath = "${rootProject.extra["distDir"]}/build.txt" -val mainCfg = configurations.create("default") +val buildVersion by configurations.creating -artifacts.add(mainCfg.name, file(buildVersionFilePath)) - -val mainTask = task("prepare") { +val prepare = task("prepare") { val versionString = rootProject.extra["build.number"].toString() val versionFile = File(buildVersionFilePath) outputs.file(buildVersionFilePath) outputs.upToDateWhen { - (versionFile.exists() && versionFile.readText().trim() == versionString).apply { - if (!this) { - println("!!! not up-to-date $versionFile: ${versionFile.takeIf { it.exists() }?.readText()?.trim()}") + (versionFile.exists() && versionFile.readText().trim() == versionString).also { + if (!it) { + logger.info("$versionFile is not up-to-date: ${versionFile.takeIf { it.exists() }?.readText()?.trim()}") } } } @@ -24,5 +22,6 @@ val mainTask = task("prepare") { } } -defaultTasks(mainTask.name) - +artifacts.add(buildVersion.name, file(buildVersionFilePath)) { + builtBy(prepare) +} diff --git a/prepare/daemon-client/build.gradle.kts b/prepare/daemon-client/build.gradle.kts deleted file mode 100644 index d69675aaa01..00000000000 --- a/prepare/daemon-client/build.gradle.kts +++ /dev/null @@ -1,31 +0,0 @@ - -description = "Kotlin Daemon Client" - -apply { plugin("kotlin") } - -val nativePlatformUberjar = "$rootDir/dependencies/native-platform-uberjar.jar" - -dependencies { - val compile by configurations - compile(project(":compiler:util")) - compile(project(":compiler:cli-common")) - compile(project(":compiler:daemon-common")) - compile(files(nativePlatformUberjar)) - buildVersion() -} - -sourceSets { - "main" { default() } - "test" { none() } -} - -runtimeJar { - from(zipTree(nativePlatformUberjar)) -} - -sourcesJar() -javadocJar() - -dist() - -publish() diff --git a/prepare/jps-plugin/build.gradle.kts b/prepare/jps-plugin/build.gradle.kts index 23dfb64860f..55b121345de 100644 --- a/prepare/jps-plugin/build.gradle.kts +++ b/prepare/jps-plugin/build.gradle.kts @@ -1,10 +1,24 @@ -import org.gradle.jvm.tasks.Jar +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -apply { plugin("java") } +description = "Kotlin JPS plugin" + +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath("com.github.jengelman.gradle.plugins:shadow:2.0.1") + } +} + +plugins { + `java-base` +} val projectsToShadow = listOf( - ":build-common", + ":kotlin-build-common", ":compiler:cli-common", ":compiler:compiler-runner", ":kotlin-daemon-client", @@ -17,31 +31,19 @@ val projectsToShadow = listOf( ":core:util.runtime", ":plugins:android-extensions-jps") -dependencies {} +val fatJarContents by configurations.creating -val jar: Jar by tasks -jar.apply { - setupRuntimeJar("Kotlin JPS plugin") - manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main") - manifest.attributes.put("Class-Path", "kotlin-runtime.jar") - archiveName = "kotlin-jps-plugin.jar" +dependencies { projectsToShadow.forEach { - dependsOn("$it:classes") - project(it).let { p -> - p.pluginManager.withPlugin("java") { - from(p.the().sourceSets.getByName("main").output) - } - } + fatJarContents(project(it)) { isTransitive = false } } - from(fileTree("$rootDir/jps-plugin/src")) { include("META-INF/**") } +} + +runtimeJar(task("jar")) { + manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main") + manifest.attributes.put("Class-Path", "kotlin-stdlib.jar") + from(fatJarContents) from(files("$rootDir/resources/kotlinManifest.properties")) - from(zipTree("$rootDir/dependencies/native-platform-uberjar.jar")) -} - -configureKotlinProjectSources() // no sources -configureKotlinProjectNoTests() - -ideaPlugin("lib/jps") { - from(jar) } +ideaPlugin("lib/jps") diff --git a/prepare/kotlin-plugin/build.gradle.kts b/prepare/kotlin-plugin/build.gradle.kts index 3ce343acb23..185fd6d6cf0 100644 --- a/prepare/kotlin-plugin/build.gradle.kts +++ b/prepare/kotlin-plugin/build.gradle.kts @@ -16,7 +16,7 @@ val projectsToShadow = listOf( ":plugins:annotation-based-compiler-plugins-ide-support", ":compiler:backend", ":compiler:backend-common", - ":build-common", + ":kotlin-build-common", ":compiler:cli-common", ":compiler:container", ":compiler:daemon-common", diff --git a/settings.gradle b/settings.gradle index 6fc630db87e..ee6e7ca760a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,7 +12,7 @@ pluginManagement { // modules //include ":buildSrc" // this fixes import into idea, so buildsrc is not longer imported with different gradle version -include ":build-common", +include ":kotlin-build-common", ":compiler", ":compiler:util", ":compiler:daemon-common", @@ -46,6 +46,7 @@ include ":build-common", ":js:js.dce", ":js:js.tests", ":jps-plugin", + ":kotlin-jps-plugin", ":core", ":core:builtins", ":core:reflection.jvm", @@ -92,7 +93,7 @@ include ":build-common", ":kotlin-stdlib-jre8", ":kotlin-stdlib:samples", ":prepare:build.version", - ":prepare:jps-plugin", + ":kotlin-build-common", ":prepare:formatter", ":prepare:ide-lazy-resolver", ":prepare:kotlin-plugin", @@ -142,6 +143,7 @@ project(':kotlin-compiler-embeddable').projectDir = "$rootDir/prepare/compiler-e project(':kotlin-compiler-client-embeddable').projectDir = "$rootDir/prepare/compiler-client-embeddable" as File project(':kotlin-daemon-client').projectDir = "$rootDir/prepare/daemon-client" as File project(':kotlin-preloader').projectDir = "$rootDir/compiler/preloader" as File +project(':kotlin-build-common').projectDir = "$rootDir/build-common" as File project(':compiler:cli-common').projectDir = "$rootDir/compiler/cli/cli-common" as File project(':kotlin-runner').projectDir = "$rootDir/compiler/cli/cli-runner" as File project(':compiler:daemon-common').projectDir = "$rootDir/compiler/daemon/daemon-common" as File @@ -150,6 +152,7 @@ project(':kotlin-ant').projectDir = "$rootDir/ant" as File project(':compiler:ir.tree').projectDir = "$rootDir/compiler/ir/ir.tree" as File project(':compiler:ir.psi2ir').projectDir = "$rootDir/compiler/ir/ir.psi2ir" as File project(':compiler:ir.ir2cfg').projectDir = "$rootDir/compiler/ir/ir.ir2cfg" as File +project(':kotlin-jps-plugin').projectDir = "$rootDir/prepare/jps-plugin" as File project(':idea:idea-android-output-parser').projectDir = "$rootDir/idea/idea-android/idea-android-output-parser" 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