diff --git a/build.gradle.kts b/build.gradle.kts index c17d758bd65..25cb9249c35 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -547,8 +547,6 @@ allprojects { tasks { register("listArchives") { listConfigurationContents("archives") } - register("listRuntimeJar") { listConfigurationContents("runtimeJar") } - register("listDistJar") { listConfigurationContents("distJar") } // Aggregate task for build related checks diff --git a/buildSrc/src/main/kotlin/artifacts.kt b/buildSrc/src/main/kotlin/artifacts.kt index 7f22d950757..755ab23233e 100644 --- a/buildSrc/src/main/kotlin/artifacts.kt +++ b/buildSrc/src/main/kotlin/artifacts.kt @@ -1,5 +1,6 @@ @file:Suppress("unused") // usages in build scripts are not tracked properly +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.gradle.publish.PublishTask import org.gradle.api.Project import org.gradle.api.Task @@ -8,8 +9,6 @@ import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.ConfigurationContainer import org.gradle.api.artifacts.PublishArtifact import org.gradle.api.artifacts.component.ProjectComponentIdentifier -import org.gradle.api.attributes.Bundling -import org.gradle.api.attributes.Category import org.gradle.api.attributes.LibraryElements import org.gradle.api.attributes.Usage import org.gradle.api.component.AdhocComponentWithVariants @@ -68,15 +67,9 @@ fun Project.noDefaultJar() { } } -fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider = runtimeJar(getOrCreateTask("jar", body)) { } - -fun Project.runtimeJar(task: TaskProvider, body: T.() -> Unit = {}): TaskProvider { - - tasks.named("jar").configure { - removeArtifacts(configurations.getOrCreate("archives"), this) - } - - task.configure { +fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider { + val jarTask = tasks.named("jar") + jarTask.configure { configurations.findByName("embedded")?.let { embedded -> dependsOn(embedded) from { @@ -88,29 +81,23 @@ fun Project.runtimeJar(task: TaskProvider, body: T.() -> Unit = {}) body() } + return jarTask +} + +fun Project.runtimeJar(task: TaskProvider, body: ShadowJar.() -> Unit = {}): TaskProvider { + + noDefaultJar() + + task.configure { + configurations = configurations + listOf(project.configurations["embedded"]) + setupPublicJar(project.the().archivesBaseName) + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + body() + } + project.addArtifact("archives", task, task) - project.addArtifact("runtimeJar", task, task) - project.configurations.findByName("runtime")?.let { - project.addArtifact(it.name, task, task) - } - - val runtimeJar = configurations.maybeCreate("runtimeJar").apply { - isCanBeConsumed = true - isCanBeResolved = false - attributes { - attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY)) - attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) - attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL)) - attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR)) - } - } - - configurePublishedComponent { - withVariantsFromConfiguration(configurations[RUNTIME_ELEMENTS_CONFIGURATION_NAME]) { skip() } - addVariantsFromConfiguration(runtimeJar) { } - } - - (components.findByName("java") as AdhocComponentWithVariants?)?.addVariantsFromConfiguration(runtimeJar) { } + project.addArtifact("runtimeElements", task, task) + project.addArtifact("apiElements", task, task) return task } diff --git a/buildSrc/src/main/kotlin/dependencies.kt b/buildSrc/src/main/kotlin/dependencies.kt index 565c636af73..d4eaf090e0f 100644 --- a/buildSrc/src/main/kotlin/dependencies.kt +++ b/buildSrc/src/main/kotlin/dependencies.kt @@ -108,8 +108,6 @@ fun Project.kotlinBuiltins(forJvm: Boolean): Any = else dependencies.project(":core:builtins", configuration = "runtimeElementsJvm".takeIf { forJvm }) fun DependencyHandler.projectTests(name: String): ProjectDependency = project(name, configuration = "tests-jar") -fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar") -fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives") enum class JpsDepScope { COMPILE, TEST, RUNTIME, PROVIDED diff --git a/buildSrc/src/main/kotlin/embeddable.kt b/buildSrc/src/main/kotlin/embeddable.kt index aa5cb3e6211..b930b3bef51 100644 --- a/buildSrc/src/main/kotlin/embeddable.kt +++ b/buildSrc/src/main/kotlin/embeddable.kt @@ -4,12 +4,13 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.gradle.api.Project import org.gradle.api.artifacts.DependencySubstitution import org.gradle.api.artifacts.component.ProjectComponentSelector +import org.gradle.api.attributes.LibraryElements +import org.gradle.api.attributes.Usage import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.tasks.TaskProvider import org.gradle.jvm.tasks.Jar import org.gradle.kotlin.dsl.named import org.gradle.kotlin.dsl.project -import org.gradle.kotlin.dsl.provideDelegate import org.gradle.kotlin.dsl.register import java.io.File @@ -69,10 +70,18 @@ private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boo } } -private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Unit): TaskProvider { +private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Unit): TaskProvider { - val compilerJar = configurations.getOrCreate("compilerJar") - dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler", configuration = "runtimeJar")) + val compilerJar = configurations.getOrCreate("compilerJar").apply { + isCanBeConsumed = false + isCanBeResolved = true + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) + attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR)) + } + } + + dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler")) { isTransitive = false } return tasks.register(taskName) { destinationDirectory.set(project.file(File(buildDir, "libs"))) @@ -100,7 +109,7 @@ fun Project.configureShadowJarSubstitutionInCompileClasspath() { } } -fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): TaskProvider = +fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): TaskProvider = compilerShadowJar(taskName) { configureEmbeddableCompilerRelocation() body() @@ -141,8 +150,8 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting( } fun Project.rewriteDepsToShadedJar( - originalJarTask: TaskProvider, shadowJarTask: TaskProvider, body: Jar.() -> Unit = {} -): TaskProvider { + originalJarTask: TaskProvider, shadowJarTask: TaskProvider, body: Jar.() -> Unit = {} +): TaskProvider { originalJarTask.configure { archiveClassifier.set("original") } @@ -154,7 +163,7 @@ fun Project.rewriteDepsToShadedJar( // When Gradle traverses the inputs, reject the shaded compiler JAR, // which leads to the content of that JAR being excluded as well: - val compilerDummyJarFile = project.provider { configurations.getByName("compilerDummyJar").singleFile } + val compilerDummyJarFile = project.provider { project.configurations.getByName("compilerDummyJar").singleFile } exclude { it.file == compilerDummyJarFile.get() } archiveClassifier.set("original") @@ -163,8 +172,8 @@ fun Project.rewriteDepsToShadedJar( return shadowJarTask } -fun Project.rewriteDepsToShadedCompiler(originalJarTask: TaskProvider, body: Jar.() -> Unit = {}): TaskProvider = +fun Project.rewriteDepsToShadedCompiler(originalJarTask: TaskProvider, body: Jar.() -> Unit = {}): TaskProvider = rewriteDepsToShadedJar(originalJarTask, embeddableCompilerDummyForDependenciesRewriting(), body) -fun Project.rewriteDefaultJarDepsToShadedCompiler(body: Jar.() -> Unit = {}): TaskProvider = +fun Project.rewriteDefaultJarDepsToShadedCompiler(body: Jar.() -> Unit = {}): TaskProvider = rewriteDepsToShadedJar(tasks.named("jar"), embeddableCompilerDummyForDependenciesRewriting(), body) diff --git a/compiler/compiler-runner/build.gradle.kts b/compiler/compiler-runner/build.gradle.kts index 6ea4f958d1b..db7edad44a3 100644 --- a/compiler/compiler-runner/build.gradle.kts +++ b/compiler/compiler-runner/build.gradle.kts @@ -12,10 +12,10 @@ dependencies { compileOnly(project(":compiler:frontend.java")) compileOnly(project(":daemon-common")) compileOnly(project(":daemon-common-new")) - api(projectRuntimeJar(":kotlin-daemon-client")) + api(project(":kotlin-daemon-client")) compileOnly(project(":compiler:util")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } - runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) + runtimeOnly(project(":kotlin-compiler-embeddable")) api(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } } diff --git a/compiler/daemon/daemon-tests/build.gradle.kts b/compiler/daemon/daemon-tests/build.gradle.kts index b6b551071d0..94ed85de302 100644 --- a/compiler/daemon/daemon-tests/build.gradle.kts +++ b/compiler/daemon/daemon-tests/build.gradle.kts @@ -14,8 +14,8 @@ dependencies { testApi(commonDep("junit:junit")) testCompileOnly(project(":kotlin-test:kotlin-test-jvm")) testCompileOnly(project(":kotlin-test:kotlin-test-junit")) - testApi(projectRuntimeJar(":kotlin-daemon-client")) - testApi(projectRuntimeJar(":kotlin-daemon-client-new")) + testApi(project(":kotlin-daemon-client")) + testApi(project(":kotlin-daemon-client-new")) testCompileOnly(project(":kotlin-daemon")) testApi(projectTests(":compiler:tests-common")) testApi(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } diff --git a/kotlin-native/gradle/kotlinGradlePlugin.gradle b/kotlin-native/gradle/kotlinGradlePlugin.gradle index e7a2281e35c..6fb05bd923e 100644 --- a/kotlin-native/gradle/kotlinGradlePlugin.gradle +++ b/kotlin-native/gradle/kotlinGradlePlugin.gradle @@ -13,12 +13,13 @@ project.buildscript.repositories { project.buildscript.dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}" } + configurations { kotlinCompilerClasspath } if (!(project.findProperty("withoutEmbedabble")?.toString()?.toBoolean() ?: false)) { project.dependencies { - kotlinCompilerClasspath(project(path: ":kotlin-compiler-embeddable", configuration: "runtimeJar")) + kotlinCompilerClasspath(project(":kotlin-compiler-embeddable")) } } diff --git a/kotlin-native/prepare/kotlin-native-embeddable-compiler/build.gradle.kts b/kotlin-native/prepare/kotlin-native-embeddable-compiler/build.gradle.kts index fcec723b995..d4197bdc8af 100644 --- a/kotlin-native/prepare/kotlin-native-embeddable-compiler/build.gradle.kts +++ b/kotlin-native/prepare/kotlin-native-embeddable-compiler/build.gradle.kts @@ -51,7 +51,7 @@ dependencies { kotlinNativeEmbedded(project(":kotlin-native:utilities:basic-utils")) kotlinNativeEmbedded(project(":kotlin-native:klib")) kotlinNativeEmbedded(project(":kotlin-native:endorsedLibraries:kotlinx.cli", "jvmRuntimeElements")) - kotlinNativeEmbedded(project(":kotlin-compiler", configuration = "runtimeJar")) + kotlinNativeEmbedded(project(":kotlin-compiler")) { isTransitive = false } testImplementation(commonDep("junit:junit")) testImplementation(project(":kotlin-test:kotlin-test-junit")) } 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 58eed923ba4..2bdef478234 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 @@ -22,9 +22,9 @@ dependencies { testApi(kotlinStdlib()) testApi(project(":kotlin-script-runtime")) testApi(project(":kotlin-script-util")) - testApi(projectRuntimeJar(":kotlin-daemon-client")) - testApi(projectRuntimeJar(":kotlin-daemon-embeddable")) - testApi(projectRuntimeJar(":kotlin-compiler-embeddable")) + testApi(project(":kotlin-daemon-client")) + testApi(project(":kotlin-daemon-embeddable")) + testApi(project(":kotlin-compiler-embeddable")) testApi(commonDep("junit:junit")) testApi(project(":kotlin-test:kotlin-test-junit")) testRuntimeOnly(project(":kotlin-reflect")) diff --git a/libraries/kotlinx-metadata/jvm/build.gradle.kts b/libraries/kotlinx-metadata/jvm/build.gradle.kts index ef5dffabc0b..aca6f893eb0 100644 --- a/libraries/kotlinx-metadata/jvm/build.gradle.kts +++ b/libraries/kotlinx-metadata/jvm/build.gradle.kts @@ -56,8 +56,6 @@ if (deployVersion != null) { publish() } -noDefaultJar() - runtimeJar(tasks.register("shadowJar")) { callGroovy("manifestAttributes", manifest, project) manifest.attributes["Implementation-Version"] = version diff --git a/libraries/kotlinx-metadata/klib/build.gradle.kts b/libraries/kotlinx-metadata/klib/build.gradle.kts index b9d9bccf08b..168fcaaccfb 100644 --- a/libraries/kotlinx-metadata/klib/build.gradle.kts +++ b/libraries/kotlinx-metadata/klib/build.gradle.kts @@ -24,6 +24,7 @@ sourceSets { val shadows by configurations.creating { isTransitive = false } + configurations.getByName("compileOnly").extendsFrom(shadows) configurations.getByName("testApi").extendsFrom(shadows) @@ -44,8 +45,6 @@ if (deployVersion != null) { publish() } -noDefaultJar() - runtimeJar(tasks.register("shadowJar")) { callGroovy("manifestAttributes", manifest, project) manifest.attributes["Implementation-Version"] = version diff --git a/libraries/reflect/api/build.gradle b/libraries/reflect/api/build.gradle index ffdc97b03c4..2b6086f6117 100644 --- a/libraries/reflect/api/build.gradle +++ b/libraries/reflect/api/build.gradle @@ -69,4 +69,5 @@ task java9Jar(type: Jar) { artifacts { archives java9Jar + runtimeElements java9Jar } diff --git a/libraries/scripting/jsr223-embeddable/build.gradle.kts b/libraries/scripting/jsr223-embeddable/build.gradle.kts index b1d7ada9207..42f6902b1e6 100644 --- a/libraries/scripting/jsr223-embeddable/build.gradle.kts +++ b/libraries/scripting/jsr223-embeddable/build.gradle.kts @@ -1,15 +1,11 @@ - -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import org.gradle.jvm.tasks.Jar - description = "Kotlin Scripting JSR-223 support" -plugins { java } - -val packedJars by configurations.creating +plugins { + java +} dependencies { - packedJars(project(":kotlin-scripting-jsr223-unshaded")) { isTransitive = false } + embedded(project(":kotlin-scripting-jsr223-unshaded")) { isTransitive = false } runtimeOnly(project(":kotlin-script-runtime")) runtimeOnly(kotlinStdlib()) runtimeOnly(project(":kotlin-scripting-common")) @@ -26,12 +22,6 @@ sourceSets { publish() -noDefaultJar() - -runtimeJar(rewriteDepsToShadedCompiler( - tasks.register("shadowJar") { - from(packedJars) - } -)) +runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar() javadocJar() diff --git a/libraries/scripting/jsr223-test/build.gradle.kts b/libraries/scripting/jsr223-test/build.gradle.kts index f5366e88063..b893b04d026 100644 --- a/libraries/scripting/jsr223-test/build.gradle.kts +++ b/libraries/scripting/jsr223-test/build.gradle.kts @@ -21,8 +21,8 @@ dependencies { testRuntimeOnly(project(":kotlin-reflect")) embeddableTestRuntime(commonDep("junit")) - embeddableTestRuntime(project(":kotlin-scripting-jsr223", configuration = "runtimeElements")) - embeddableTestRuntime(project(":kotlin-scripting-compiler-embeddable", configuration = "runtimeElements")) + embeddableTestRuntime(project(":kotlin-scripting-jsr223")) + embeddableTestRuntime(project(":kotlin-scripting-compiler-embeddable")) embeddableTestRuntime(testSourceSet.output) } diff --git a/libraries/scripting/jvm-host-embeddable/build.gradle.kts b/libraries/scripting/jvm-host-embeddable/build.gradle.kts index b666cff5e60..9554a2bd06c 100644 --- a/libraries/scripting/jvm-host-embeddable/build.gradle.kts +++ b/libraries/scripting/jvm-host-embeddable/build.gradle.kts @@ -1,8 +1,8 @@ -import org.gradle.jvm.tasks.Jar - description = "Kotlin Scripting JVM host (for using with embeddable compiler)" -plugins { java } +plugins { + java +} dependencies { embedded(project(":kotlin-scripting-jvm-host-unshaded")) { isTransitive = false } @@ -21,8 +21,6 @@ sourceSets { publish() -noDefaultJar() - runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar() javadocJar() diff --git a/libraries/tools/kotlin-allopen/build.gradle b/libraries/tools/kotlin-allopen/build.gradle index 6c60b0b8710..7ed4cfdd9da 100644 --- a/libraries/tools/kotlin-allopen/build.gradle +++ b/libraries/tools/kotlin-allopen/build.gradle @@ -11,13 +11,12 @@ dependencies { api project(':kotlin-gradle-plugin-api') api project(':kotlin-gradle-plugin-model') - compileOnly project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar') + compileOnly project(':kotlin-compiler-embeddable') compileOnly project(':kotlin-allopen-compiler-plugin') embedded(project(":kotlin-allopen-compiler-plugin")) { transitive = false } } -ArtifactsKt.noDefaultJar(project) ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {}) configureSourcesJar() configureJavadocJar() diff --git a/libraries/tools/kotlin-annotation-processing/build.gradle.kts b/libraries/tools/kotlin-annotation-processing/build.gradle.kts index 1ec4fcbc29b..fb879305509 100644 --- a/libraries/tools/kotlin-annotation-processing/build.gradle.kts +++ b/libraries/tools/kotlin-annotation-processing/build.gradle.kts @@ -12,7 +12,7 @@ val packedJars by configurations.creating dependencies { api(kotlinStdlib()) packedJars(project(":kotlin-annotation-processing")) { isTransitive = false } - runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) + runtimeOnly(project(":kotlin-compiler-embeddable")) } projectTest(parallel = true) { diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts index 44ed33c92de..1304d8b7996 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle.kts @@ -14,6 +14,7 @@ val kotlinGradlePluginTest = project(":kotlin-gradle-plugin").sourceSets.named(" dependencies { testImplementation(project(":kotlin-gradle-plugin")) + testImplementation(project(":kotlin-gradle-plugin-model")) testImplementation(project(":kotlin-project-model")) testImplementation(project(":kotlin-tooling-metadata")) testImplementation(kotlinGradlePluginTest) @@ -26,12 +27,12 @@ dependencies { testImplementation(project(":native:kotlin-native-utils")) testImplementation(project(":native:kotlin-klib-commonizer-api")) - testImplementation(projectRuntimeJar(":kotlin-compiler-embeddable")) + testImplementation(project(":kotlin-compiler-embeddable")) testImplementation(intellijCoreDep()) { includeJars("jdom") } // testCompileOnly dependency on non-shaded artifacts is needed for IDE support // testRuntimeOnly on shaded artifact is needed for running tests with shaded compiler - testCompileOnly(project(path = ":kotlin-gradle-plugin-test-utils-embeddable", configuration = "compile")) - testRuntimeOnly(projectRuntimeJar(":kotlin-gradle-plugin-test-utils-embeddable")) + testCompileOnly(project(":kotlin-gradle-plugin-test-utils-embeddable")) + testRuntimeOnly(project(":kotlin-gradle-plugin-test-utils-embeddable")) testImplementation(project(path = ":examples:annotation-processor-example")) testImplementation(kotlinStdlib("jdk8")) @@ -45,7 +46,7 @@ dependencies { testImplementation("com.google.code.gson:gson:${rootProject.extra["versions.jar.gson"]}") testApiJUnit5(vintageEngine = true, jupiterParams = true) - testRuntimeOnly(projectRuntimeJar(":kotlin-android-extensions")) + testRuntimeOnly(project(":kotlin-android-extensions")) testRuntimeOnly(project(":compiler:tests-mutes")) // Workaround for missing transitive import of the common(project `kotlin-test-common` diff --git a/libraries/tools/kotlin-gradle-plugin-test-utils-embeddable/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin-test-utils-embeddable/build.gradle.kts index c692b508d53..0962452a0e3 100644 --- a/libraries/tools/kotlin-gradle-plugin-test-utils-embeddable/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin-test-utils-embeddable/build.gradle.kts @@ -3,18 +3,12 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ - -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import org.gradle.jvm.tasks.Jar - description = "Shaded test jars from compiler for Gradle integration tests" plugins { `java-library` } -val packedJars by configurations.creating - val projectsToInclude = listOf( ":compiler:test-infrastructure-utils", ":compiler:tests-common", @@ -25,15 +19,10 @@ val projectsToInclude = listOf( dependencies { for (projectName in projectsToInclude) { api(projectTests(projectName)) { isTransitive = false } - packedJars(projectTests(projectName)) { isTransitive = false } + embedded(projectTests(projectName)) { isTransitive = false } } - packedJars(intellijDep()) { includeJars("idea_rt") } - + embedded(intellijDep()) { includeJars("idea_rt") } } -runtimeJar(rewriteDepsToShadedCompiler( - tasks.register("shadowJar") { - from(packedJars) - } -)) +runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) diff --git a/libraries/tools/kotlin-gradle-plugin/build.gradle.kts b/libraries/tools/kotlin-gradle-plugin/build.gradle.kts index 759e1ff8cdb..aac5ac66ccf 100644 --- a/libraries/tools/kotlin-gradle-plugin/build.gradle.kts +++ b/libraries/tools/kotlin-gradle-plugin/build.gradle.kts @@ -16,8 +16,6 @@ configure { isAutomatedPublishing = false } -val jarContents by configurations.creating - repositories { google() maven("https://plugins.gradle.org/m2/") @@ -66,14 +64,14 @@ dependencies { compileOnly(project(":kotlin-reflect")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } - runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) - runtimeOnly(projectRuntimeJar(":kotlin-annotation-processing-gradle")) - runtimeOnly(projectRuntimeJar(":kotlin-android-extensions")) - runtimeOnly(projectRuntimeJar(":kotlin-compiler-runner")) - runtimeOnly(projectRuntimeJar(":kotlin-scripting-compiler-embeddable")) - runtimeOnly(projectRuntimeJar(":kotlin-scripting-compiler-impl-embeddable")) + runtimeOnly(project(":kotlin-compiler-embeddable")) + runtimeOnly(project(":kotlin-annotation-processing-gradle")) + runtimeOnly(project(":kotlin-android-extensions")) + runtimeOnly(project(":kotlin-compiler-runner")) + runtimeOnly(project(":kotlin-scripting-compiler-embeddable")) + runtimeOnly(project(":kotlin-scripting-compiler-impl-embeddable")) - jarContents(compileOnly(intellijDep()) { + embedded(compileOnly(intellijDep()) { includeJars("asm-all", "gson", "guava", "serviceMessages", rootProject = rootProject) }) @@ -105,17 +103,7 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) { configurations.api.get().exclude("com.android.tools.external.com-intellij", "intellij-core") } -noDefaultJar() -runtimeJar(rewriteDefaultJarDepsToShadedCompiler()).configure { - dependsOn(jarContents) - - from { - jarContents.asFileTree.map { - if (it.endsWith(".jar")) zipTree(it) - else it - } - } -} +runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) tasks { named("processResources") { diff --git a/libraries/tools/kotlin-lombok/build.gradle.kts b/libraries/tools/kotlin-lombok/build.gradle.kts index 014fc33b671..48101c85296 100644 --- a/libraries/tools/kotlin-lombok/build.gradle.kts +++ b/libraries/tools/kotlin-lombok/build.gradle.kts @@ -21,7 +21,6 @@ publishGradlePlugin() sourcesJar() javadocJar() -noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) tasks { diff --git a/libraries/tools/kotlin-noarg/build.gradle b/libraries/tools/kotlin-noarg/build.gradle index 4016d43b518..4334e635794 100644 --- a/libraries/tools/kotlin-noarg/build.gradle +++ b/libraries/tools/kotlin-noarg/build.gradle @@ -20,7 +20,6 @@ dependencies { embedded(project(":kotlin-noarg-compiler-plugin")) { transitive = false } } -ArtifactsKt.noDefaultJar(project) ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {}) pluginBundle { diff --git a/libraries/tools/kotlin-sam-with-receiver/build.gradle b/libraries/tools/kotlin-sam-with-receiver/build.gradle index 65f57fba30b..b5294d247e8 100644 --- a/libraries/tools/kotlin-sam-with-receiver/build.gradle +++ b/libraries/tools/kotlin-sam-with-receiver/build.gradle @@ -20,5 +20,4 @@ dependencies { embedded(project(":kotlin-sam-with-receiver-compiler-plugin")) { transitive = false } } -ArtifactsKt.noDefaultJar(project) ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {}) diff --git a/libraries/tools/kotlin-script-util/build.gradle.kts b/libraries/tools/kotlin-script-util/build.gradle.kts index ccf7d7a797e..7afe54c60bc 100644 --- a/libraries/tools/kotlin-script-util/build.gradle.kts +++ b/libraries/tools/kotlin-script-util/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { compileOnly(project(":compiler:cli")) compileOnly(project(":daemon-common")) compileOnly(project(":kotlin-scripting-compiler")) - api(projectRuntimeJar(":kotlin-daemon-client")) + api(project(":kotlin-daemon-client")) compileOnly("org.jetbrains.kotlin:jcabi-aether:1.0-dev-3") compileOnly("org.sonatype.aether:aether-api:1.13.1") compileOnly("org.apache.maven:maven-core:3.0.3") diff --git a/libraries/tools/kotlin-serialization-unshaded/build.gradle b/libraries/tools/kotlin-serialization-unshaded/build.gradle index fc6c5478d59..6201329647c 100644 --- a/libraries/tools/kotlin-serialization-unshaded/build.gradle +++ b/libraries/tools/kotlin-serialization-unshaded/build.gradle @@ -6,11 +6,6 @@ dependencies { embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false } } -TaskProvider jar = tasks.named("jar") -jar.configure { - manifestAttributes(manifest, project) -} - -ArtifactsKt.runtimeJar(project, jar, {}) +ArtifactsKt.runtimeJar(project, {}) configureSourcesJar() configureJavadocJar() diff --git a/libraries/tools/kotlin-serialization/build.gradle b/libraries/tools/kotlin-serialization/build.gradle index e8c288dea06..c2c25873385 100644 --- a/libraries/tools/kotlin-serialization/build.gradle +++ b/libraries/tools/kotlin-serialization/build.gradle @@ -12,7 +12,7 @@ dependencies { api project(':kotlin-gradle-plugin-api') compileOnly kotlinStdlib() - compileOnly project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar') + compileOnly project(':kotlin-compiler-embeddable') embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false } } @@ -21,7 +21,6 @@ jar { manifestAttributes(manifest, project) } -ArtifactsKt.noDefaultJar(project) ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {}) configureSourcesJar() configureJavadocJar() diff --git a/libraries/tools/kotlinp/build.gradle.kts b/libraries/tools/kotlinp/build.gradle.kts index 5a96fa78fe5..b2bf9f941f0 100644 --- a/libraries/tools/kotlinp/build.gradle.kts +++ b/libraries/tools/kotlinp/build.gradle.kts @@ -26,13 +26,13 @@ dependencies { testImplementation(projectTests(":compiler:tests-common")) testImplementation(projectTests(":generators:test-generator")) - testRuntimeOnly(project(":kotlinx-metadata-jvm"/*, configuration = "runtime"*/)) + testRuntimeOnly(project(":kotlinx-metadata-jvm")) testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijDep()) { includeJars("platform-concurrency", "platform-objectSerializer") } - shadows(project(":kotlinx-metadata-jvm", configuration = "runtimeElements")) + shadows(project(":kotlinx-metadata-jvm")) shadows("org.jetbrains.intellij.deps:asm-all:$kotlinpAsmVersion") } diff --git a/native/commonizer-embeddable/build.gradle.kts b/native/commonizer-embeddable/build.gradle.kts index 6e3758720af..cb54696fa61 100644 --- a/native/commonizer-embeddable/build.gradle.kts +++ b/native/commonizer-embeddable/build.gradle.kts @@ -17,8 +17,6 @@ sourceSets { publish() -noDefaultJar() - runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar { includeEmptyDirs = false; eachFile { exclude() } } // empty Jar, no public sources javadocJar { includeEmptyDirs = false; eachFile { exclude() } } // empty Jar, no public javadocs diff --git a/plugins/scripting/scripting-compiler-embeddable/build.gradle.kts b/plugins/scripting/scripting-compiler-embeddable/build.gradle.kts index c6f9042b654..53bc2e098a3 100644 --- a/plugins/scripting/scripting-compiler-embeddable/build.gradle.kts +++ b/plugins/scripting/scripting-compiler-embeddable/build.gradle.kts @@ -1,25 +1,18 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -plugins { java } - description = "Kotlin Scripting Compiler Plugin for embeddable compiler" -val packedJars by configurations.creating +plugins { + java +} + dependencies { - packedJars(project(":kotlin-scripting-compiler")) { isTransitive = false } + embedded(project(":kotlin-scripting-compiler")) { isTransitive = false } runtimeOnly(project(":kotlin-scripting-compiler-impl-embeddable")) runtimeOnly(kotlinStdlib()) } publish() -noDefaultJar() - -runtimeJar(rewriteDepsToShadedCompiler( - tasks.register("shadowJar") { - from(packedJars) - } -)) +runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar() javadocJar() diff --git a/plugins/scripting/scripting-compiler-impl-embeddable/build.gradle.kts b/plugins/scripting/scripting-compiler-impl-embeddable/build.gradle.kts index 69a83bebb27..97b9e16401d 100644 --- a/plugins/scripting/scripting-compiler-impl-embeddable/build.gradle.kts +++ b/plugins/scripting/scripting-compiler-impl-embeddable/build.gradle.kts @@ -1,12 +1,11 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -plugins { java } - description = "Kotlin Compiler Infrastructure for Scripting for embeddable compiler" -val packedJars by configurations.creating +plugins { + java +} + dependencies { - packedJars(project(":kotlin-scripting-compiler-impl")) { isTransitive = false } + embedded(project(":kotlin-scripting-compiler-impl")) { isTransitive = false } runtimeOnly(project(":kotlin-scripting-common")) runtimeOnly(project(":kotlin-scripting-jvm")) runtimeOnly(kotlinStdlib()) @@ -14,11 +13,6 @@ dependencies { publish() -noDefaultJar() -runtimeJar(rewriteDepsToShadedCompiler( - tasks.register("shadowJar") { - from(packedJars) - } -)) +runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar() javadocJar() diff --git a/plugins/scripting/scripting-ide-services-embeddable/build.gradle.kts b/plugins/scripting/scripting-ide-services-embeddable/build.gradle.kts index ae49a090327..0c4d7c2d5e7 100644 --- a/plugins/scripting/scripting-ide-services-embeddable/build.gradle.kts +++ b/plugins/scripting/scripting-ide-services-embeddable/build.gradle.kts @@ -1,6 +1,8 @@ description = "Kotlin Scripting Compiler extension providing code completion and static analysis (for using in embeddable mode)" -plugins { java } +plugins { + java +} dependencies { embedded(project(":kotlin-scripting-ide-services-unshaded")) { isTransitive = false } @@ -20,8 +22,6 @@ sourceSets { publish() -noDefaultJar() - runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar() javadocJar() diff --git a/prepare/android-extensions-compiler-gradle/build.gradle.kts b/prepare/android-extensions-compiler-gradle/build.gradle.kts index eaf9607d39f..e96e9f87ad3 100644 --- a/prepare/android-extensions-compiler-gradle/build.gradle.kts +++ b/prepare/android-extensions-compiler-gradle/build.gradle.kts @@ -1,6 +1,3 @@ - -import org.gradle.jvm.tasks.Jar - description = "Kotlin Android Extensions Compiler" plugins { @@ -14,7 +11,7 @@ dependencies { compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:backend")) compileOnly(project(":kotlin-android-extensions-runtime")) - runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) + runtimeOnly(project(":kotlin-compiler-embeddable")) compileOnly(commonDep("com.google.android", "android")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } @@ -29,7 +26,6 @@ sourceSets { publish() -noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar() diff --git a/prepare/compiler-client-embeddable/build.gradle.kts b/prepare/compiler-client-embeddable/build.gradle.kts index bba9e305115..e9afa7a615b 100644 --- a/prepare/compiler-client-embeddable/build.gradle.kts +++ b/prepare/compiler-client-embeddable/build.gradle.kts @@ -17,12 +17,12 @@ dependencies { embedded(project(":compiler:cli-common")) { isTransitive = false } embedded(project(":daemon-common")) { isTransitive = false } embedded(project(":daemon-common-new")) { isTransitive = false } - embedded(projectRuntimeJar(":kotlin-daemon-client")) + embedded(project(":kotlin-daemon-client")) { isTransitive = false } testApi(project(":compiler:cli-common")) testApi(project(":daemon-common")) testApi(project(":daemon-common-new")) - testApi(projectRuntimeJar(":kotlin-daemon-client")) + testApi(project(":kotlin-daemon-client")) testApi(commonDep("junit:junit")) testApi(project(":kotlin-test:kotlin-test-jvm")) testApi(project(":kotlin-test:kotlin-test-junit")) diff --git a/prepare/compiler-embeddable/build.gradle.kts b/prepare/compiler-embeddable/build.gradle.kts index 4c693becc44..d8b07dbeb8b 100644 --- a/prepare/compiler-embeddable/build.gradle.kts +++ b/prepare/compiler-embeddable/build.gradle.kts @@ -41,8 +41,6 @@ sourceSets { publish() -noDefaultJar() - // dummy is used for rewriting dependencies to the shaded packages in the embeddable compiler compilerDummyJar(compilerDummyForDependenciesRewriting("compilerDummy") { archiveClassifier.set("dummy") diff --git a/prepare/kotlin-annotation-processing-embeddable/build.gradle.kts b/prepare/kotlin-annotation-processing-embeddable/build.gradle.kts index c97afe1e0a3..c1a743b1659 100644 --- a/prepare/kotlin-annotation-processing-embeddable/build.gradle.kts +++ b/prepare/kotlin-annotation-processing-embeddable/build.gradle.kts @@ -1,9 +1,7 @@ -import org.gradle.jvm.tasks.Jar - description = "Annotation Processor for Kotlin (for using with embeddable compiler)" plugins { - `java` + java } dependencies { @@ -12,7 +10,6 @@ dependencies { publish() -noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar() diff --git a/prepare/kotlin-daemon-embeddable/build.gradle.kts b/prepare/kotlin-daemon-embeddable/build.gradle.kts index 332fb8517e1..d4a201c303b 100644 --- a/prepare/kotlin-daemon-embeddable/build.gradle.kts +++ b/prepare/kotlin-daemon-embeddable/build.gradle.kts @@ -10,7 +10,6 @@ dependencies { publish() -noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar() diff --git a/prepare/parcelize-compiler-gradle/build.gradle.kts b/prepare/parcelize-compiler-gradle/build.gradle.kts index f3d36018e60..f53f5b8defd 100644 --- a/prepare/parcelize-compiler-gradle/build.gradle.kts +++ b/prepare/parcelize-compiler-gradle/build.gradle.kts @@ -1,5 +1,3 @@ -import org.gradle.jvm.tasks.Jar - description = "Parcelize compiler plugin" plugins { @@ -13,7 +11,7 @@ dependencies { compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:backend")) compileOnly(project(":plugins:parcelize:parcelize-runtime")) - runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) + runtimeOnly(project(":kotlin-compiler-embeddable")) compileOnly(commonDep("com.google.android", "android")) compileOnly(intellijCoreDep()) { includeJars("intellij-core") } @@ -28,7 +26,6 @@ sourceSets { publish() -noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) sourcesJar()