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
+1 -2
View File
@@ -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()
@@ -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) {
@@ -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`
@@ -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>("shadowJar") {
from(packedJars)
}
))
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
@@ -16,8 +16,6 @@ configure<GradlePluginDevelopmentExtension> {
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>("processResources") {
@@ -21,7 +21,6 @@ publishGradlePlugin()
sourcesJar()
javadocJar()
noDefaultJar()
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
tasks {
@@ -20,7 +20,6 @@ dependencies {
embedded(project(":kotlin-noarg-compiler-plugin")) { transitive = false }
}
ArtifactsKt.noDefaultJar(project)
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
pluginBundle {
@@ -20,5 +20,4 @@ dependencies {
embedded(project(":kotlin-sam-with-receiver-compiler-plugin")) { transitive = false }
}
ArtifactsKt.noDefaultJar(project)
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
@@ -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")
@@ -6,11 +6,6 @@ dependencies {
embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false }
}
TaskProvider<Jar> jar = tasks.named("jar")
jar.configure {
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, jar, {})
ArtifactsKt.runtimeJar(project, {})
configureSourcesJar()
configureJavadocJar()
@@ -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()
+2 -2
View File
@@ -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")
}