Build: Rework runtimeJar helper and drop redundant configuration

#KTI-559
This commit is contained in:
Vyacheslav Gerasimov
2021-07-21 17:00:57 +03:00
parent ab146bd6d4
commit f91d6958a8
37 changed files with 104 additions and 185 deletions
-2
View File
@@ -547,8 +547,6 @@ allprojects {
tasks { tasks {
register("listArchives") { listConfigurationContents("archives") } register("listArchives") { listConfigurationContents("archives") }
register("listRuntimeJar") { listConfigurationContents("runtimeJar") }
register("listDistJar") { listConfigurationContents("distJar") } register("listDistJar") { listConfigurationContents("distJar") }
// Aggregate task for build related checks // Aggregate task for build related checks
+20 -33
View File
@@ -1,5 +1,6 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly @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 com.gradle.publish.PublishTask
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.Task 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.ConfigurationContainer
import org.gradle.api.artifacts.PublishArtifact import org.gradle.api.artifacts.PublishArtifact
import org.gradle.api.artifacts.component.ProjectComponentIdentifier 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.LibraryElements
import org.gradle.api.attributes.Usage import org.gradle.api.attributes.Usage
import org.gradle.api.component.AdhocComponentWithVariants import org.gradle.api.component.AdhocComponentWithVariants
@@ -68,15 +67,9 @@ fun Project.noDefaultJar() {
} }
} }
fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<Jar> = runtimeJar(getOrCreateTask("jar", body)) { } fun Project.runtimeJar(body: Jar.() -> Unit = {}): TaskProvider<out Jar> {
val jarTask = tasks.named<Jar>("jar")
fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {}): TaskProvider<T> { jarTask.configure {
tasks.named<Jar>("jar").configure {
removeArtifacts(configurations.getOrCreate("archives"), this)
}
task.configure {
configurations.findByName("embedded")?.let { embedded -> configurations.findByName("embedded")?.let { embedded ->
dependsOn(embedded) dependsOn(embedded)
from { from {
@@ -88,29 +81,23 @@ fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {})
body() body()
} }
return jarTask
}
fun Project.runtimeJar(task: TaskProvider<ShadowJar>, body: ShadowJar.() -> Unit = {}): TaskProvider<out Jar> {
noDefaultJar()
task.configure {
configurations = configurations + listOf(project.configurations["embedded"])
setupPublicJar(project.the<BasePluginConvention>().archivesBaseName)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
body()
}
project.addArtifact("archives", task, task) project.addArtifact("archives", task, task)
project.addArtifact("runtimeJar", task, task) project.addArtifact("runtimeElements", task, task)
project.configurations.findByName("runtime")?.let { project.addArtifact("apiElements", task, task)
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) { }
return task return task
} }
-2
View File
@@ -108,8 +108,6 @@ fun Project.kotlinBuiltins(forJvm: Boolean): Any =
else dependencies.project(":core:builtins", configuration = "runtimeElementsJvm".takeIf { forJvm }) else dependencies.project(":core:builtins", configuration = "runtimeElementsJvm".takeIf { forJvm })
fun DependencyHandler.projectTests(name: String): ProjectDependency = project(name, configuration = "tests-jar") 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 { enum class JpsDepScope {
COMPILE, TEST, RUNTIME, PROVIDED COMPILE, TEST, RUNTIME, PROVIDED
+19 -10
View File
@@ -4,12 +4,13 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.artifacts.DependencySubstitution import org.gradle.api.artifacts.DependencySubstitution
import org.gradle.api.artifacts.component.ProjectComponentSelector 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.file.DuplicatesStrategy
import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.TaskProvider
import org.gradle.jvm.tasks.Jar import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.named import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.project import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.register import org.gradle.kotlin.dsl.register
import java.io.File import java.io.File
@@ -69,10 +70,18 @@ private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boo
} }
} }
private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Unit): TaskProvider<out ShadowJar> { private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Unit): TaskProvider<ShadowJar> {
val compilerJar = configurations.getOrCreate("compilerJar") val compilerJar = configurations.getOrCreate("compilerJar").apply {
dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler", configuration = "runtimeJar")) 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<ShadowJar>(taskName) { return tasks.register<ShadowJar>(taskName) {
destinationDirectory.set(project.file(File(buildDir, "libs"))) destinationDirectory.set(project.file(File(buildDir, "libs")))
@@ -100,7 +109,7 @@ fun Project.configureShadowJarSubstitutionInCompileClasspath() {
} }
} }
fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): TaskProvider<out ShadowJar> = fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): TaskProvider<ShadowJar> =
compilerShadowJar(taskName) { compilerShadowJar(taskName) {
configureEmbeddableCompilerRelocation() configureEmbeddableCompilerRelocation()
body() body()
@@ -141,8 +150,8 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(
} }
fun Project.rewriteDepsToShadedJar( fun Project.rewriteDepsToShadedJar(
originalJarTask: TaskProvider<out Jar>, shadowJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {} originalJarTask: TaskProvider<out Jar>, shadowJarTask: TaskProvider<ShadowJar>, body: Jar.() -> Unit = {}
): TaskProvider<out Jar> { ): TaskProvider<ShadowJar> {
originalJarTask.configure { originalJarTask.configure {
archiveClassifier.set("original") archiveClassifier.set("original")
} }
@@ -154,7 +163,7 @@ fun Project.rewriteDepsToShadedJar(
// When Gradle traverses the inputs, reject the shaded compiler JAR, // When Gradle traverses the inputs, reject the shaded compiler JAR,
// which leads to the content of that JAR being excluded as well: // 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() } exclude { it.file == compilerDummyJarFile.get() }
archiveClassifier.set("original") archiveClassifier.set("original")
@@ -163,8 +172,8 @@ fun Project.rewriteDepsToShadedJar(
return shadowJarTask return shadowJarTask
} }
fun Project.rewriteDepsToShadedCompiler(originalJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}): TaskProvider<out Jar> = fun Project.rewriteDepsToShadedCompiler(originalJarTask: TaskProvider<out Jar>, body: Jar.() -> Unit = {}): TaskProvider<ShadowJar> =
rewriteDepsToShadedJar(originalJarTask, embeddableCompilerDummyForDependenciesRewriting(), body) rewriteDepsToShadedJar(originalJarTask, embeddableCompilerDummyForDependenciesRewriting(), body)
fun Project.rewriteDefaultJarDepsToShadedCompiler(body: Jar.() -> Unit = {}): TaskProvider<out Jar> = fun Project.rewriteDefaultJarDepsToShadedCompiler(body: Jar.() -> Unit = {}): TaskProvider<ShadowJar> =
rewriteDepsToShadedJar(tasks.named<Jar>("jar"), embeddableCompilerDummyForDependenciesRewriting(), body) rewriteDepsToShadedJar(tasks.named<Jar>("jar"), embeddableCompilerDummyForDependenciesRewriting(), body)
+2 -2
View File
@@ -12,10 +12,10 @@ dependencies {
compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":daemon-common")) compileOnly(project(":daemon-common"))
compileOnly(project(":daemon-common-new")) compileOnly(project(":daemon-common-new"))
api(projectRuntimeJar(":kotlin-daemon-client")) api(project(":kotlin-daemon-client"))
compileOnly(project(":compiler:util")) compileOnly(project(":compiler:util"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") } 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 } api(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
} }
@@ -14,8 +14,8 @@ dependencies {
testApi(commonDep("junit:junit")) testApi(commonDep("junit:junit"))
testCompileOnly(project(":kotlin-test:kotlin-test-jvm")) testCompileOnly(project(":kotlin-test:kotlin-test-jvm"))
testCompileOnly(project(":kotlin-test:kotlin-test-junit")) testCompileOnly(project(":kotlin-test:kotlin-test-junit"))
testApi(projectRuntimeJar(":kotlin-daemon-client")) testApi(project(":kotlin-daemon-client"))
testApi(projectRuntimeJar(":kotlin-daemon-client-new")) testApi(project(":kotlin-daemon-client-new"))
testCompileOnly(project(":kotlin-daemon")) testCompileOnly(project(":kotlin-daemon"))
testApi(projectTests(":compiler:tests-common")) testApi(projectTests(":compiler:tests-common"))
testApi(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } testApi(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
@@ -13,12 +13,13 @@ project.buildscript.repositories {
project.buildscript.dependencies { project.buildscript.dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}"
} }
configurations { configurations {
kotlinCompilerClasspath kotlinCompilerClasspath
} }
if (!(project.findProperty("withoutEmbedabble")?.toString()?.toBoolean() ?: false)) { if (!(project.findProperty("withoutEmbedabble")?.toString()?.toBoolean() ?: false)) {
project.dependencies { project.dependencies {
kotlinCompilerClasspath(project(path: ":kotlin-compiler-embeddable", configuration: "runtimeJar")) kotlinCompilerClasspath(project(":kotlin-compiler-embeddable"))
} }
} }
@@ -51,7 +51,7 @@ dependencies {
kotlinNativeEmbedded(project(":kotlin-native:utilities:basic-utils")) kotlinNativeEmbedded(project(":kotlin-native:utilities:basic-utils"))
kotlinNativeEmbedded(project(":kotlin-native:klib")) kotlinNativeEmbedded(project(":kotlin-native:klib"))
kotlinNativeEmbedded(project(":kotlin-native:endorsedLibraries:kotlinx.cli", "jvmRuntimeElements")) 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(commonDep("junit:junit"))
testImplementation(project(":kotlin-test:kotlin-test-junit")) testImplementation(project(":kotlin-test:kotlin-test-junit"))
} }
@@ -22,9 +22,9 @@ dependencies {
testApi(kotlinStdlib()) testApi(kotlinStdlib())
testApi(project(":kotlin-script-runtime")) testApi(project(":kotlin-script-runtime"))
testApi(project(":kotlin-script-util")) testApi(project(":kotlin-script-util"))
testApi(projectRuntimeJar(":kotlin-daemon-client")) testApi(project(":kotlin-daemon-client"))
testApi(projectRuntimeJar(":kotlin-daemon-embeddable")) testApi(project(":kotlin-daemon-embeddable"))
testApi(projectRuntimeJar(":kotlin-compiler-embeddable")) testApi(project(":kotlin-compiler-embeddable"))
testApi(commonDep("junit:junit")) testApi(commonDep("junit:junit"))
testApi(project(":kotlin-test:kotlin-test-junit")) testApi(project(":kotlin-test:kotlin-test-junit"))
testRuntimeOnly(project(":kotlin-reflect")) testRuntimeOnly(project(":kotlin-reflect"))
@@ -56,8 +56,6 @@ if (deployVersion != null) {
publish() publish()
} }
noDefaultJar()
runtimeJar(tasks.register<ShadowJar>("shadowJar")) { runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
callGroovy("manifestAttributes", manifest, project) callGroovy("manifestAttributes", manifest, project)
manifest.attributes["Implementation-Version"] = version manifest.attributes["Implementation-Version"] = version
@@ -24,6 +24,7 @@ sourceSets {
val shadows by configurations.creating { val shadows by configurations.creating {
isTransitive = false isTransitive = false
} }
configurations.getByName("compileOnly").extendsFrom(shadows) configurations.getByName("compileOnly").extendsFrom(shadows)
configurations.getByName("testApi").extendsFrom(shadows) configurations.getByName("testApi").extendsFrom(shadows)
@@ -44,8 +45,6 @@ if (deployVersion != null) {
publish() publish()
} }
noDefaultJar()
runtimeJar(tasks.register<ShadowJar>("shadowJar")) { runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
callGroovy("manifestAttributes", manifest, project) callGroovy("manifestAttributes", manifest, project)
manifest.attributes["Implementation-Version"] = version manifest.attributes["Implementation-Version"] = version
+1
View File
@@ -69,4 +69,5 @@ task java9Jar(type: Jar) {
artifacts { artifacts {
archives java9Jar archives java9Jar
runtimeElements java9Jar
} }
@@ -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" description = "Kotlin Scripting JSR-223 support"
plugins { java } plugins {
java
val packedJars by configurations.creating }
dependencies { dependencies {
packedJars(project(":kotlin-scripting-jsr223-unshaded")) { isTransitive = false } embedded(project(":kotlin-scripting-jsr223-unshaded")) { isTransitive = false }
runtimeOnly(project(":kotlin-script-runtime")) runtimeOnly(project(":kotlin-script-runtime"))
runtimeOnly(kotlinStdlib()) runtimeOnly(kotlinStdlib())
runtimeOnly(project(":kotlin-scripting-common")) runtimeOnly(project(":kotlin-scripting-common"))
@@ -26,12 +22,6 @@ sourceSets {
publish() publish()
noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
sourcesJar() sourcesJar()
javadocJar() javadocJar()
@@ -21,8 +21,8 @@ dependencies {
testRuntimeOnly(project(":kotlin-reflect")) testRuntimeOnly(project(":kotlin-reflect"))
embeddableTestRuntime(commonDep("junit")) embeddableTestRuntime(commonDep("junit"))
embeddableTestRuntime(project(":kotlin-scripting-jsr223", configuration = "runtimeElements")) embeddableTestRuntime(project(":kotlin-scripting-jsr223"))
embeddableTestRuntime(project(":kotlin-scripting-compiler-embeddable", configuration = "runtimeElements")) embeddableTestRuntime(project(":kotlin-scripting-compiler-embeddable"))
embeddableTestRuntime(testSourceSet.output) embeddableTestRuntime(testSourceSet.output)
} }
@@ -1,8 +1,8 @@
import org.gradle.jvm.tasks.Jar
description = "Kotlin Scripting JVM host (for using with embeddable compiler)" description = "Kotlin Scripting JVM host (for using with embeddable compiler)"
plugins { java } plugins {
java
}
dependencies { dependencies {
embedded(project(":kotlin-scripting-jvm-host-unshaded")) { isTransitive = false } embedded(project(":kotlin-scripting-jvm-host-unshaded")) { isTransitive = false }
@@ -21,8 +21,6 @@ sourceSets {
publish() publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
sourcesJar() sourcesJar()
javadocJar() javadocJar()
+1 -2
View File
@@ -11,13 +11,12 @@ dependencies {
api project(':kotlin-gradle-plugin-api') api project(':kotlin-gradle-plugin-api')
api project(':kotlin-gradle-plugin-model') 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') compileOnly project(':kotlin-allopen-compiler-plugin')
embedded(project(":kotlin-allopen-compiler-plugin")) { transitive = false } embedded(project(":kotlin-allopen-compiler-plugin")) { transitive = false }
} }
ArtifactsKt.noDefaultJar(project)
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {}) ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
configureSourcesJar() configureSourcesJar()
configureJavadocJar() configureJavadocJar()
@@ -12,7 +12,7 @@ val packedJars by configurations.creating
dependencies { dependencies {
api(kotlinStdlib()) api(kotlinStdlib())
packedJars(project(":kotlin-annotation-processing")) { isTransitive = false } packedJars(project(":kotlin-annotation-processing")) { isTransitive = false }
runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) runtimeOnly(project(":kotlin-compiler-embeddable"))
} }
projectTest(parallel = true) { projectTest(parallel = true) {
@@ -14,6 +14,7 @@ val kotlinGradlePluginTest = project(":kotlin-gradle-plugin").sourceSets.named("
dependencies { dependencies {
testImplementation(project(":kotlin-gradle-plugin")) testImplementation(project(":kotlin-gradle-plugin"))
testImplementation(project(":kotlin-gradle-plugin-model"))
testImplementation(project(":kotlin-project-model")) testImplementation(project(":kotlin-project-model"))
testImplementation(project(":kotlin-tooling-metadata")) testImplementation(project(":kotlin-tooling-metadata"))
testImplementation(kotlinGradlePluginTest) testImplementation(kotlinGradlePluginTest)
@@ -26,12 +27,12 @@ dependencies {
testImplementation(project(":native:kotlin-native-utils")) testImplementation(project(":native:kotlin-native-utils"))
testImplementation(project(":native:kotlin-klib-commonizer-api")) testImplementation(project(":native:kotlin-klib-commonizer-api"))
testImplementation(projectRuntimeJar(":kotlin-compiler-embeddable")) testImplementation(project(":kotlin-compiler-embeddable"))
testImplementation(intellijCoreDep()) { includeJars("jdom") } testImplementation(intellijCoreDep()) { includeJars("jdom") }
// testCompileOnly dependency on non-shaded artifacts is needed for IDE support // testCompileOnly dependency on non-shaded artifacts is needed for IDE support
// testRuntimeOnly on shaded artifact is needed for running tests with shaded compiler // testRuntimeOnly on shaded artifact is needed for running tests with shaded compiler
testCompileOnly(project(path = ":kotlin-gradle-plugin-test-utils-embeddable", configuration = "compile")) testCompileOnly(project(":kotlin-gradle-plugin-test-utils-embeddable"))
testRuntimeOnly(projectRuntimeJar(":kotlin-gradle-plugin-test-utils-embeddable")) testRuntimeOnly(project(":kotlin-gradle-plugin-test-utils-embeddable"))
testImplementation(project(path = ":examples:annotation-processor-example")) testImplementation(project(path = ":examples:annotation-processor-example"))
testImplementation(kotlinStdlib("jdk8")) testImplementation(kotlinStdlib("jdk8"))
@@ -45,7 +46,7 @@ dependencies {
testImplementation("com.google.code.gson:gson:${rootProject.extra["versions.jar.gson"]}") testImplementation("com.google.code.gson:gson:${rootProject.extra["versions.jar.gson"]}")
testApiJUnit5(vintageEngine = true, jupiterParams = true) testApiJUnit5(vintageEngine = true, jupiterParams = true)
testRuntimeOnly(projectRuntimeJar(":kotlin-android-extensions")) testRuntimeOnly(project(":kotlin-android-extensions"))
testRuntimeOnly(project(":compiler:tests-mutes")) testRuntimeOnly(project(":compiler:tests-mutes"))
// Workaround for missing transitive import of the common(project `kotlin-test-common` // Workaround for missing transitive import of the common(project `kotlin-test-common`
@@ -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. * 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" description = "Shaded test jars from compiler for Gradle integration tests"
plugins { plugins {
`java-library` `java-library`
} }
val packedJars by configurations.creating
val projectsToInclude = listOf( val projectsToInclude = listOf(
":compiler:test-infrastructure-utils", ":compiler:test-infrastructure-utils",
":compiler:tests-common", ":compiler:tests-common",
@@ -25,15 +19,10 @@ val projectsToInclude = listOf(
dependencies { dependencies {
for (projectName in projectsToInclude) { for (projectName in projectsToInclude) {
api(projectTests(projectName)) { isTransitive = false } 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( runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
@@ -16,8 +16,6 @@ configure<GradlePluginDevelopmentExtension> {
isAutomatedPublishing = false isAutomatedPublishing = false
} }
val jarContents by configurations.creating
repositories { repositories {
google() google()
maven("https://plugins.gradle.org/m2/") maven("https://plugins.gradle.org/m2/")
@@ -66,14 +64,14 @@ dependencies {
compileOnly(project(":kotlin-reflect")) compileOnly(project(":kotlin-reflect"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") } compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) runtimeOnly(project(":kotlin-compiler-embeddable"))
runtimeOnly(projectRuntimeJar(":kotlin-annotation-processing-gradle")) runtimeOnly(project(":kotlin-annotation-processing-gradle"))
runtimeOnly(projectRuntimeJar(":kotlin-android-extensions")) runtimeOnly(project(":kotlin-android-extensions"))
runtimeOnly(projectRuntimeJar(":kotlin-compiler-runner")) runtimeOnly(project(":kotlin-compiler-runner"))
runtimeOnly(projectRuntimeJar(":kotlin-scripting-compiler-embeddable")) runtimeOnly(project(":kotlin-scripting-compiler-embeddable"))
runtimeOnly(projectRuntimeJar(":kotlin-scripting-compiler-impl-embeddable")) runtimeOnly(project(":kotlin-scripting-compiler-impl-embeddable"))
jarContents(compileOnly(intellijDep()) { embedded(compileOnly(intellijDep()) {
includeJars("asm-all", "gson", "guava", "serviceMessages", rootProject = rootProject) 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") configurations.api.get().exclude("com.android.tools.external.com-intellij", "intellij-core")
} }
noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()).configure {
dependsOn(jarContents)
from {
jarContents.asFileTree.map {
if (it.endsWith(".jar")) zipTree(it)
else it
}
}
}
tasks { tasks {
named<ProcessResources>("processResources") { named<ProcessResources>("processResources") {
@@ -21,7 +21,6 @@ publishGradlePlugin()
sourcesJar() sourcesJar()
javadocJar() javadocJar()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
tasks { tasks {
@@ -20,7 +20,6 @@ dependencies {
embedded(project(":kotlin-noarg-compiler-plugin")) { transitive = false } embedded(project(":kotlin-noarg-compiler-plugin")) { transitive = false }
} }
ArtifactsKt.noDefaultJar(project)
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {}) ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
pluginBundle { pluginBundle {
@@ -20,5 +20,4 @@ dependencies {
embedded(project(":kotlin-sam-with-receiver-compiler-plugin")) { transitive = false } embedded(project(":kotlin-sam-with-receiver-compiler-plugin")) { transitive = false }
} }
ArtifactsKt.noDefaultJar(project)
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {}) ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
@@ -14,7 +14,7 @@ dependencies {
compileOnly(project(":compiler:cli")) compileOnly(project(":compiler:cli"))
compileOnly(project(":daemon-common")) compileOnly(project(":daemon-common"))
compileOnly(project(":kotlin-scripting-compiler")) 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.jetbrains.kotlin:jcabi-aether:1.0-dev-3")
compileOnly("org.sonatype.aether:aether-api:1.13.1") compileOnly("org.sonatype.aether:aether-api:1.13.1")
compileOnly("org.apache.maven:maven-core:3.0.3") compileOnly("org.apache.maven:maven-core:3.0.3")
@@ -6,11 +6,6 @@ dependencies {
embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false } embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false }
} }
TaskProvider<Jar> jar = tasks.named("jar") ArtifactsKt.runtimeJar(project, {})
jar.configure {
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, jar, {})
configureSourcesJar() configureSourcesJar()
configureJavadocJar() configureJavadocJar()
@@ -12,7 +12,7 @@ dependencies {
api project(':kotlin-gradle-plugin-api') api project(':kotlin-gradle-plugin-api')
compileOnly kotlinStdlib() compileOnly kotlinStdlib()
compileOnly project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar') compileOnly project(':kotlin-compiler-embeddable')
embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false } embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false }
} }
@@ -21,7 +21,6 @@ jar {
manifestAttributes(manifest, project) manifestAttributes(manifest, project)
} }
ArtifactsKt.noDefaultJar(project)
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {}) ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
configureSourcesJar() configureSourcesJar()
configureJavadocJar() configureJavadocJar()
+2 -2
View File
@@ -26,13 +26,13 @@ dependencies {
testImplementation(projectTests(":compiler:tests-common")) testImplementation(projectTests(":compiler:tests-common"))
testImplementation(projectTests(":generators:test-generator")) testImplementation(projectTests(":generators:test-generator"))
testRuntimeOnly(project(":kotlinx-metadata-jvm"/*, configuration = "runtime"*/)) testRuntimeOnly(project(":kotlinx-metadata-jvm"))
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijDep()) { includeJars("platform-concurrency", "platform-objectSerializer") } 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") shadows("org.jetbrains.intellij.deps:asm-all:$kotlinpAsmVersion")
} }
@@ -17,8 +17,6 @@ sourceSets {
publish() publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
sourcesJar { includeEmptyDirs = false; eachFile { exclude() } } // empty Jar, no public sources sourcesJar { includeEmptyDirs = false; eachFile { exclude() } } // empty Jar, no public sources
javadocJar { includeEmptyDirs = false; eachFile { exclude() } } // empty Jar, no public javadocs javadocJar { includeEmptyDirs = false; eachFile { exclude() } } // empty Jar, no public javadocs
@@ -1,25 +1,18 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins { java }
description = "Kotlin Scripting Compiler Plugin for embeddable compiler" description = "Kotlin Scripting Compiler Plugin for embeddable compiler"
val packedJars by configurations.creating plugins {
java
}
dependencies { dependencies {
packedJars(project(":kotlin-scripting-compiler")) { isTransitive = false } embedded(project(":kotlin-scripting-compiler")) { isTransitive = false }
runtimeOnly(project(":kotlin-scripting-compiler-impl-embeddable")) runtimeOnly(project(":kotlin-scripting-compiler-impl-embeddable"))
runtimeOnly(kotlinStdlib()) runtimeOnly(kotlinStdlib())
} }
publish() publish()
noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
sourcesJar() sourcesJar()
javadocJar() javadocJar()
@@ -1,12 +1,11 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins { java }
description = "Kotlin Compiler Infrastructure for Scripting for embeddable compiler" description = "Kotlin Compiler Infrastructure for Scripting for embeddable compiler"
val packedJars by configurations.creating plugins {
java
}
dependencies { 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-common"))
runtimeOnly(project(":kotlin-scripting-jvm")) runtimeOnly(project(":kotlin-scripting-jvm"))
runtimeOnly(kotlinStdlib()) runtimeOnly(kotlinStdlib())
@@ -14,11 +13,6 @@ dependencies {
publish() publish()
noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
sourcesJar() sourcesJar()
javadocJar() javadocJar()
@@ -1,6 +1,8 @@
description = "Kotlin Scripting Compiler extension providing code completion and static analysis (for using in embeddable mode)" description = "Kotlin Scripting Compiler extension providing code completion and static analysis (for using in embeddable mode)"
plugins { java } plugins {
java
}
dependencies { dependencies {
embedded(project(":kotlin-scripting-ide-services-unshaded")) { isTransitive = false } embedded(project(":kotlin-scripting-ide-services-unshaded")) { isTransitive = false }
@@ -20,8 +22,6 @@ sourceSets {
publish() publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
sourcesJar() sourcesJar()
javadocJar() javadocJar()
@@ -1,6 +1,3 @@
import org.gradle.jvm.tasks.Jar
description = "Kotlin Android Extensions Compiler" description = "Kotlin Android Extensions Compiler"
plugins { plugins {
@@ -14,7 +11,7 @@ dependencies {
compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":compiler:backend")) compileOnly(project(":compiler:backend"))
compileOnly(project(":kotlin-android-extensions-runtime")) compileOnly(project(":kotlin-android-extensions-runtime"))
runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) runtimeOnly(project(":kotlin-compiler-embeddable"))
compileOnly(commonDep("com.google.android", "android")) compileOnly(commonDep("com.google.android", "android"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") } compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
@@ -29,7 +26,6 @@ sourceSets {
publish() publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
sourcesJar() sourcesJar()
@@ -17,12 +17,12 @@ dependencies {
embedded(project(":compiler:cli-common")) { isTransitive = false } embedded(project(":compiler:cli-common")) { isTransitive = false }
embedded(project(":daemon-common")) { isTransitive = false } embedded(project(":daemon-common")) { isTransitive = false }
embedded(project(":daemon-common-new")) { 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(":compiler:cli-common"))
testApi(project(":daemon-common")) testApi(project(":daemon-common"))
testApi(project(":daemon-common-new")) testApi(project(":daemon-common-new"))
testApi(projectRuntimeJar(":kotlin-daemon-client")) testApi(project(":kotlin-daemon-client"))
testApi(commonDep("junit:junit")) testApi(commonDep("junit:junit"))
testApi(project(":kotlin-test:kotlin-test-jvm")) testApi(project(":kotlin-test:kotlin-test-jvm"))
testApi(project(":kotlin-test:kotlin-test-junit")) testApi(project(":kotlin-test:kotlin-test-junit"))
@@ -41,8 +41,6 @@ sourceSets {
publish() publish()
noDefaultJar()
// dummy is used for rewriting dependencies to the shaded packages in the embeddable compiler // dummy is used for rewriting dependencies to the shaded packages in the embeddable compiler
compilerDummyJar(compilerDummyForDependenciesRewriting("compilerDummy") { compilerDummyJar(compilerDummyForDependenciesRewriting("compilerDummy") {
archiveClassifier.set("dummy") archiveClassifier.set("dummy")
@@ -1,9 +1,7 @@
import org.gradle.jvm.tasks.Jar
description = "Annotation Processor for Kotlin (for using with embeddable compiler)" description = "Annotation Processor for Kotlin (for using with embeddable compiler)"
plugins { plugins {
`java` java
} }
dependencies { dependencies {
@@ -12,7 +10,6 @@ dependencies {
publish() publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
sourcesJar() sourcesJar()
@@ -10,7 +10,6 @@ dependencies {
publish() publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
sourcesJar() sourcesJar()
@@ -1,5 +1,3 @@
import org.gradle.jvm.tasks.Jar
description = "Parcelize compiler plugin" description = "Parcelize compiler plugin"
plugins { plugins {
@@ -13,7 +11,7 @@ dependencies {
compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":compiler:backend")) compileOnly(project(":compiler:backend"))
compileOnly(project(":plugins:parcelize:parcelize-runtime")) compileOnly(project(":plugins:parcelize:parcelize-runtime"))
runtimeOnly(projectRuntimeJar(":kotlin-compiler-embeddable")) runtimeOnly(project(":kotlin-compiler-embeddable"))
compileOnly(commonDep("com.google.android", "android")) compileOnly(commonDep("com.google.android", "android"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") } compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
@@ -28,7 +26,6 @@ sourceSets {
publish() publish()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()) runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
sourcesJar() sourcesJar()