From 96d5e0bb21be0cc6344ded3eb5c8495c75850c1b Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Mon, 11 Sep 2017 14:21:44 +0200 Subject: [PATCH] Refactoring - renaming projects, applying sourceSets DSL --- ant/build.gradle.kts | 18 +++++-------- build.gradle.kts | 4 ++- compiler.tests-common/build.gradle.kts | 4 +-- compiler/build.gradle.kts | 4 +-- compiler/cli/cli-runner/build.gradle.kts | 17 +++++------- compiler/compiler-runner/build.gradle.kts | 2 +- .../daemon/daemon-client/build.gradle.kts | 23 ++++++---------- idea/build.gradle.kts | 4 +-- idea/idea-core/build.gradle.kts | 2 +- jps-plugin/build.gradle.kts | 2 +- .../build.gradle | 2 +- .../tools/kotlin-gradle-plugin/build.gradle | 2 +- plugins/allopen/allopen-cli/build.gradle.kts | 6 +++-- .../build.gradle.kts | 21 ++++++++------- .../android-extensions-idea/build.gradle.kts | 2 +- .../android-extensions-jps/build.gradle.kts | 2 +- plugins/plugins-tests/build.gradle.kts | 2 +- .../sam-with-receiver-cli/build.gradle.kts | 6 +++-- .../source-sections-compiler/build.gradle.kts | 27 +++++++++---------- .../build.gradle.kts | 2 +- prepare/daemon-client/build.gradle.kts | 12 ++++----- prepare/jps-plugin/build.gradle.kts | 2 +- settings.gradle | 11 ++++---- 23 files changed, 84 insertions(+), 93 deletions(-) diff --git a/ant/build.gradle.kts b/ant/build.gradle.kts index dd780a5dc30..a89a603efe7 100644 --- a/ant/build.gradle.kts +++ b/ant/build.gradle.kts @@ -1,5 +1,5 @@ -import org.gradle.jvm.tasks.Jar +description = "Kotlin Ant Tools" apply { plugin("kotlin") } @@ -11,19 +11,15 @@ dependencies { buildVersion() } -configureKotlinProjectSourcesDefault() -configureKotlinProjectNoTests() +sourceSets { + "main" { default() } + "test" { none() } +} -val jar: Jar by tasks -jar.apply { - setupRuntimeJar("Kotlin Ant Tools") - archiveName = "kotlin-ant.jar" +runtimeJar { from("$projectDir/src") { include("**/*.xml") } - manifest.attributes.put("Class-Path", "kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar kotlin-preloader.jar") } -dist { - from(jar) -} +dist() diff --git a/build.gradle.kts b/build.gradle.kts index 52d0315747f..f173f97078c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,10 +51,12 @@ dependencies { val commonBuildDir = File(rootDir, "build") val distDir = "$rootDir/dist" -val distLibDir = "$distDir/kotlinc/lib" +val distKotlinHomeDir = "$distDir/kotlinc" +val distLibDir = "$distKotlinHomeDir/lib" val ideaPluginDir = "$distDir/artifacts/Kotlin" extra["distDir"] = distDir +extra["distKotlinHomeDir"] = distKotlinHomeDir extra["distLibDir"] = project.file(distLibDir) extra["libsDir"] = project.file(distLibDir) extra["ideaPluginDir"] = project.file(ideaPluginDir) diff --git a/compiler.tests-common/build.gradle.kts b/compiler.tests-common/build.gradle.kts index c32529e1236..8d60501098a 100644 --- a/compiler.tests-common/build.gradle.kts +++ b/compiler.tests-common/build.gradle.kts @@ -18,11 +18,11 @@ dependencies { compile(project(":compiler:serialization")) compile(project(":kotlin-preloader")) compile(project(":compiler:daemon-common")) - compile(project(":compiler:daemon-client")) + compile(project(":kotlin-daemon-client")) compile(project(":js:js.serializer")) compile(project(":js:js.frontend")) compile(project(":js:js.translator")) - compile(project(":plugins:android-extensions-compiler")) + compile(project(":android-extensions-compiler")) compile(project(":kotlin-test:kotlin-test-jvm")) compile(commonDep("junit")) compile(ideaSdkCoreDeps("intellij-core")) diff --git a/compiler/build.gradle.kts b/compiler/build.gradle.kts index 10c837b66aa..05b1a6cc0b3 100644 --- a/compiler/build.gradle.kts +++ b/compiler/build.gradle.kts @@ -32,8 +32,8 @@ dependencies { testCompile(project(":kotlin-script-runtime")) testCompile(project(":kotlin-runtime")) testCompile(project(":kotlin-reflect")) - testCompile(project(":plugins:android-extensions-compiler")) - testCompile(project(":ant")) + testCompile(project(":android-extensions-compiler")) + testCompile(project(":kotlin-ant")) otherCompilerModules.forEach { testCompile(project(it)) } diff --git a/compiler/cli/cli-runner/build.gradle.kts b/compiler/cli/cli-runner/build.gradle.kts index 1050442bc0b..6558287c135 100644 --- a/compiler/cli/cli-runner/build.gradle.kts +++ b/compiler/cli/cli-runner/build.gradle.kts @@ -1,5 +1,5 @@ -import org.gradle.jvm.tasks.Jar +description = "Kotlin Runner" apply { plugin("kotlin") } @@ -9,18 +9,15 @@ dependencies { buildVersion() } -configureKotlinProjectSourcesDefault() -configureKotlinProjectNoTests() +sourceSets { + "main" { default() } + "test" { none() } +} -val jar: Jar by tasks -jar.apply { - setupRuntimeJar("Kotlin Runner") +runtimeJar { manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main") manifest.attributes.put("Class-Path", "kotlin-runtime.jar") - archiveName = "kotlin-runner.jar" } -dist { - from(jar) -} +dist() diff --git a/compiler/compiler-runner/build.gradle.kts b/compiler/compiler-runner/build.gradle.kts index 7a0fe44369c..eb75c29a059 100644 --- a/compiler/compiler-runner/build.gradle.kts +++ b/compiler/compiler-runner/build.gradle.kts @@ -8,7 +8,7 @@ dependencies { compile(project(":kotlin-preloader")) compile(project(":compiler:frontend.java")) compile(project(":compiler:daemon-common")) - compile(project(":compiler:daemon-client")) + compile(project(":kotlin-daemon-client")) compile(project(":compiler:util")) } diff --git a/compiler/daemon/daemon-client/build.gradle.kts b/compiler/daemon/daemon-client/build.gradle.kts index 1b9eb5e1d25..fb38a395be1 100644 --- a/compiler/daemon/daemon-client/build.gradle.kts +++ b/compiler/daemon/daemon-client/build.gradle.kts @@ -1,5 +1,5 @@ -import org.gradle.jvm.tasks.Jar +description = "Kotlin Daemon Client" apply { plugin("kotlin") } @@ -14,22 +14,15 @@ dependencies { buildVersion() } -configureKotlinProjectSourcesDefault() -configureKotlinProjectNoTests() +sourceSets { + "main" { default() } + "test" { none() } +} -val jar: Jar by tasks -jar.apply { - setupRuntimeJar("Kotlin Daemon Client") +runtimeJar { from(zipTree(nativePlatformUberjar)) - archiveName = "kotlin-daemon-client.jar" } +sourcesJar() -val sourcesJar by task { - setupSourceJar("Kotlin Daemon Client") - archiveName = "kotlin-daemon-client-sources.jar" -} - -dist { - from(jar) -} +dist() diff --git a/idea/build.gradle.kts b/idea/build.gradle.kts index 875b878f8c5..842fe26447e 100644 --- a/idea/build.gradle.kts +++ b/idea/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { compile(project(":core")) compile(project(":compiler:backend")) compile(project(":compiler:cli-common")) - compile(project(":compiler:daemon-client")) + compile(project(":kotlin-daemon-client")) compile(project(":compiler:frontend")) compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.script")) @@ -76,7 +76,7 @@ dependencies { testRuntime(preloadedDeps("uast-common", "uast-java")) // deps below are test runtime deps, but made test compile to split compilation and running to reduce mem req - testCompile(project(":plugins:android-extensions-compiler")) + testCompile(project(":android-extensions-compiler")) testCompile(project(":plugins:android-extensions-idea")) { isTransitive = false } testCompile(project(":plugins:allopen-ide")) { isTransitive = false } testCompile(project(":kotlin-allopen-compiler-plugin")) diff --git a/idea/idea-core/build.gradle.kts b/idea/idea-core/build.gradle.kts index e618e2c212b..9d65ce7c7ce 100644 --- a/idea/idea-core/build.gradle.kts +++ b/idea/idea-core/build.gradle.kts @@ -12,7 +12,7 @@ dependencies { compile(project(":j2k")) compile(project(":idea:ide-common")) compile(project(":idea:idea-jps-common")) - compile(project(":plugins:android-extensions-compiler")) + compile(project(":android-extensions-compiler")) compile(ideaSdkCoreDeps("intellij-core", "util")) compile(ideaSdkDeps("openapi", "idea")) compile(ideaPluginDeps("gradle-tooling-api", "gradle", plugin = "gradle")) diff --git a/jps-plugin/build.gradle.kts b/jps-plugin/build.gradle.kts index 2b03ddde878..974969c6b80 100644 --- a/jps-plugin/build.gradle.kts +++ b/jps-plugin/build.gradle.kts @@ -16,7 +16,7 @@ dependencies { compile(project(":core")) compile(project(":compiler:compiler-runner")) compile(project(":compiler:daemon-common")) - compile(project(":compiler:daemon-client")) + compile(project(":kotlin-daemon-client")) compile(project(":compiler:frontend.java")) compile(project(":kotlin-preloader")) compile(project(":idea:idea-jps-common")) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle index 609ed0e9e23..d136daf7f17 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle @@ -16,7 +16,7 @@ dependencies { testCompile project(path: ':examples:annotation-processor-example') testCompile project(':kotlin-stdlib-jre8') - testCompile project(':plugins:android-extensions-compiler') + testCompile project(':android-extensions-compiler') testCompile project(path: ':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 3326f057aac..1a6fb1bcc9f 100644 --- a/libraries/tools/kotlin-gradle-plugin/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin/build.gradle @@ -30,7 +30,7 @@ dependencies { compile project(':kotlin-gradle-plugin-api') compile project(':kotlin-stdlib') - compile project(':plugins:android-extensions-compiler') + compile project(':android-extensions-compiler') // compile project(path: ':compiler', configuration: 'embeddableCompilerJar') compile project(':build-common') compile project(':compiler:compiler-runner') diff --git a/plugins/allopen/allopen-cli/build.gradle.kts b/plugins/allopen/allopen-cli/build.gradle.kts index 41bd89f2815..aaf14b15c28 100644 --- a/plugins/allopen/allopen-cli/build.gradle.kts +++ b/plugins/allopen/allopen-cli/build.gradle.kts @@ -13,8 +13,10 @@ dependencies { runtime(project(":kotlin-stdlib")) } -configureKotlinProjectSourcesDefault() -configureKotlinProjectNoTests() +sourceSets { + "main" { default() } + "test" { none() } +} val jar = runtimeJar { from(fileTree("$projectDir/src")) { include("META-INF/**") } diff --git a/plugins/android-extensions/android-extensions-compiler/build.gradle.kts b/plugins/android-extensions/android-extensions-compiler/build.gradle.kts index 3900307dfaf..e5d81f4e917 100644 --- a/plugins/android-extensions/android-extensions-compiler/build.gradle.kts +++ b/plugins/android-extensions/android-extensions-compiler/build.gradle.kts @@ -1,5 +1,5 @@ -import org.gradle.jvm.tasks.Jar +description = "Kotlin Android Extensions Compiler" apply { plugin("kotlin") } @@ -18,16 +18,17 @@ configureKotlinProjectSources("android-extensions-compiler/src", "android-extens configureKotlinProjectResourcesDefault(sourcesBaseDir = File(rootDir, "plugins", "android-extensions", "android-extensions-compiler", "src")) configureKotlinProjectNoTests() -val jar: Jar by tasks -jar.apply { - setupRuntimeJar("Kotlin Android Extensions Compiler") +sourceSets { + "main" { + default() + java.srcDir("../android-extensions-runtime/src") + } + "test" { none() } } -dist { - from(jar) -} +runtimeJar () -ideaPlugin { - from(jar) -} +dist() + +ideaPlugin() diff --git a/plugins/android-extensions/android-extensions-idea/build.gradle.kts b/plugins/android-extensions/android-extensions-idea/build.gradle.kts index 528b3c2197e..3166080cc70 100644 --- a/plugins/android-extensions/android-extensions-idea/build.gradle.kts +++ b/plugins/android-extensions/android-extensions-idea/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { compile(project(":compiler:light-classes")) compile(project(":idea:idea-core")) compile(project(":idea")) - compile(project(":plugins:android-extensions-compiler")) + compile(project(":android-extensions-compiler")) compile(ideaPluginDeps("android", "sdk-tools", "sdk-common", plugin = "android")) compile(ideaPluginDeps("Groovy", plugin = "Groovy")) testCompile(project(":compiler.tests-common")) diff --git a/plugins/android-extensions/android-extensions-jps/build.gradle.kts b/plugins/android-extensions/android-extensions-jps/build.gradle.kts index a63ccd2f776..45acaa2554e 100644 --- a/plugins/android-extensions/android-extensions-jps/build.gradle.kts +++ b/plugins/android-extensions/android-extensions-jps/build.gradle.kts @@ -5,7 +5,7 @@ dependencies { val compile by configurations compile(project(":compiler:util")) compile(project(":jps-plugin")) - compile(project(":plugins:android-extensions-compiler")) + compile(project(":android-extensions-compiler")) compile(ideaPluginDeps("android-jps-plugin", plugin = "android", subdir = "lib/jps")) } diff --git a/plugins/plugins-tests/build.gradle.kts b/plugins/plugins-tests/build.gradle.kts index cbf3d3b51fe..10fe33a30df 100644 --- a/plugins/plugins-tests/build.gradle.kts +++ b/plugins/plugins-tests/build.gradle.kts @@ -11,7 +11,7 @@ dependencies { testCompile(project(":compiler:backend")) testCompile(project(":compiler:cli")) testCompile(project(":compiler.tests-common")) - testCompile(project(":plugins:android-extensions-compiler")) + testCompile(project(":android-extensions-compiler")) testCompile(project(":plugins:android-extensions-idea")) testCompile(project(":plugins:allopen-ide")) { isTransitive = false } testCompile(project(":kotlin-allopen-compiler-plugin")) 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 1abaa8de4ec..02ab8c9b318 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 @@ -13,8 +13,10 @@ dependencies { runtime(project(":kotlin-stdlib")) } -configureKotlinProjectSourcesDefault() -configureKotlinProjectNoTests() +sourceSets { + "main" { default() } + "test" { none() } +} val jar = runtimeJar { from(fileTree("$projectDir/src")) { include("META-INF/**") } diff --git a/plugins/source-sections/source-sections-compiler/build.gradle.kts b/plugins/source-sections/source-sections-compiler/build.gradle.kts index c5ce57937f2..882f866ab65 100644 --- a/plugins/source-sections/source-sections-compiler/build.gradle.kts +++ b/plugins/source-sections/source-sections-compiler/build.gradle.kts @@ -22,23 +22,12 @@ dependencies { testCompile(project(":compiler:cli-common")) testCompile(project(":compiler:frontend.java")) testCompile(project(":compiler:daemon-common")) - testCompile(project(":compiler:daemon-client")) + testCompile(project(":kotlin-daemon-client")) } -configureKotlinProjectSourcesDefault() -configureKotlinProjectResources("src") { - include("META-INF/**") -} -configureKotlinProjectTestsDefault() - -val jar = runtimeJar() -sourcesJar() -javadocJar() - -publish() - -dist { - from(jar) +sourceSets { + "main" { default() } + "test" { default() } } tasks.withType { @@ -46,6 +35,14 @@ tasks.withType { workingDir = rootDir systemProperty("idea.is.unit.test", "true") environment("NO_FS_ROOTS_ACCESS_CHECK", "true") + environment("KOTLIN_HOME", rootProject.extra["distKotlinHomeDir"]) ignoreFailures = true } +runtimeJar() +sourcesJar() +javadocJar() + +dist() + +publish() diff --git a/prepare/compiler-client-embeddable/build.gradle.kts b/prepare/compiler-client-embeddable/build.gradle.kts index 000cf07ecaf..06e89e3e5b5 100644 --- a/prepare/compiler-client-embeddable/build.gradle.kts +++ b/prepare/compiler-client-embeddable/build.gradle.kts @@ -27,7 +27,7 @@ val archives by configurations val projectsToInclude = listOf( ":compiler:cli-common", ":compiler:daemon-common", - ":compiler:daemon-client") + ":kotlin-daemon-client") dependencies { val testCompile by configurations diff --git a/prepare/daemon-client/build.gradle.kts b/prepare/daemon-client/build.gradle.kts index 154cf5bc0c5..d69675aaa01 100644 --- a/prepare/daemon-client/build.gradle.kts +++ b/prepare/daemon-client/build.gradle.kts @@ -14,18 +14,18 @@ dependencies { buildVersion() } -configureKotlinProjectSourcesDefault() -configureKotlinProjectNoTests() +sourceSets { + "main" { default() } + "test" { none() } +} -val jar = runtimeJar { +runtimeJar { from(zipTree(nativePlatformUberjar)) } sourcesJar() javadocJar() -dist { - from(jar) -} +dist() publish() diff --git a/prepare/jps-plugin/build.gradle.kts b/prepare/jps-plugin/build.gradle.kts index 83fc4a6e983..23dfb64860f 100644 --- a/prepare/jps-plugin/build.gradle.kts +++ b/prepare/jps-plugin/build.gradle.kts @@ -7,7 +7,7 @@ val projectsToShadow = listOf( ":build-common", ":compiler:cli-common", ":compiler:compiler-runner", - ":compiler:daemon-client", + ":kotlin-daemon-client", ":compiler:daemon-common", ":core", ":idea:idea-jps-common", diff --git a/settings.gradle b/settings.gradle index 71d1e679c48..ad6a763bc56 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,7 @@ include ":build-common", ":compiler:daemon-common", ":kotlin-daemon-client", ":kotlin-preloader", - ":compiler:cli-runner", + ":kotlin-runner", ":compiler:container", ":compiler:resolution", ":compiler:serialization", @@ -52,7 +52,7 @@ include ":build-common", ":eval4j", ":j2k", ":plugins:lint", - ":plugins:android-extensions-compiler", + ":android-extensions-compiler", ":plugins:android-extensions-idea", ":plugins:android-extensions-jps", ":kotlin-allopen-compiler-plugin", @@ -91,7 +91,7 @@ include ":build-common", ":kotlin-compiler-client-embeddable", ":kotlin-daemon-client", ":kotlin-reflect", - ":ant", + ":kotlin-ant", ":compiler:tests-java8", ":generators", ":tools:binary-compatibility-validator", @@ -128,14 +128,15 @@ project(':kotlin-compiler-client-embeddable').projectDir = "$rootDir/prepare/com project(':kotlin-daemon-client').projectDir = "$rootDir/prepare/daemon-client" as File project(':kotlin-preloader').projectDir = "$rootDir/compiler/preloader" as File project(':compiler:cli-common').projectDir = "$rootDir/compiler/cli/cli-common" as File -project(':compiler:cli-runner').projectDir = "$rootDir/compiler/cli/cli-runner" 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 project(':kotlin-daemon-client').projectDir = "$rootDir/compiler/daemon/daemon-client" as File +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(':idea:idea-android-output-parser').projectDir = "$rootDir/idea/idea-android/idea-android-output-parser" as File -project(':plugins: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-jps').projectDir = "$rootDir/plugins/android-extensions/android-extensions-jps" as File project(':kotlin-allopen-compiler-plugin').projectDir = "$rootDir/plugins/allopen/allopen-cli" as File