Switch many common tasks defined in buildSrc to lazy creation
also refactor some locally defined tasks to the creation avoidance API
This commit is contained in:
@@ -37,5 +37,5 @@ dependencies {
|
||||
|
||||
// Relocate `com.intellij.*` and some other classes to match those in the `kotlin-compiler-embeddable`
|
||||
// (for example, the actual package at runtime is `org.jetbrains.kotlin.com.intellij.*`):
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
||||
// In a standalone build, you can setup the relocation with the Shadow plugin.
|
||||
@@ -54,7 +54,7 @@ if (deployVersion != null) {
|
||||
|
||||
noDefaultJar()
|
||||
|
||||
task<ShadowJar>("shadowJar") {
|
||||
tasks.register<ShadowJar>("shadowJar") {
|
||||
callGroovy("manifestAttributes", manifest, project)
|
||||
manifest.attributes["Implementation-Version"] = version
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ publish()
|
||||
noDefaultJar()
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(
|
||||
task<ShadowJar>("shadowJar") {
|
||||
tasks.register<ShadowJar>("shadowJar") {
|
||||
from(packedJars)
|
||||
}
|
||||
))
|
||||
|
||||
@@ -23,7 +23,6 @@ publish()
|
||||
|
||||
noDefaultJar()
|
||||
|
||||
val jar = tasks.getByName<Jar>("jar")
|
||||
runtimeJar(rewriteDepsToShadedCompiler(jar))
|
||||
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
@@ -75,7 +75,7 @@ publishing {
|
||||
publications {
|
||||
create<MavenPublication>("internal") {
|
||||
artifactId = "kotlin-stdlib-minimal-for-test"
|
||||
artifact(jar)
|
||||
artifact(jar.get())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ jar {
|
||||
manifestAttributes(manifest, project)
|
||||
}
|
||||
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
|
||||
description = "Kapt - Annotation processing for Kotlin"
|
||||
@@ -22,13 +21,12 @@ projectTest(parallel = true) {
|
||||
|
||||
publish()
|
||||
|
||||
val jar: Jar by tasks
|
||||
jar.apply {
|
||||
tasks.named<Jar>("jar").configure {
|
||||
classifier = "base"
|
||||
}
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(
|
||||
task<ShadowJar>("shadowJar") {
|
||||
tasks.register<ShadowJar>("shadowJar") {
|
||||
from(packedJars)
|
||||
}
|
||||
))
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ kotlin.target.compilations {
|
||||
}
|
||||
}
|
||||
|
||||
val runBenchmark by tasks.registering(JavaExec::class) {
|
||||
val runBenchmark by tasks.registering<JavaExec> {
|
||||
classpath = kotlin.target.compilations["benchmark"].run { runtimeDependencyFiles + output.allOutputs }
|
||||
main = "com.example.ABenchmarkKt"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ dependencies {
|
||||
}
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(
|
||||
task<ShadowJar>("shadowJar") {
|
||||
tasks.register<ShadowJar>("shadowJar") {
|
||||
from(packedJars)
|
||||
}
|
||||
))
|
||||
|
||||
@@ -13,8 +13,6 @@ plugins {
|
||||
|
||||
publish()
|
||||
|
||||
// todo: make lazy
|
||||
val jar: Jar by tasks
|
||||
val jarContents by configurations.creating
|
||||
|
||||
sourcesJar()
|
||||
@@ -91,7 +89,7 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
configurations.compile.get().exclude("com.android.tools.external.com-intellij", "intellij-core")
|
||||
}
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(jar)) {
|
||||
runtimeJar(rewriteDefaultJarDepsToShadedCompiler()).configure {
|
||||
dependsOn(jarContents)
|
||||
|
||||
from {
|
||||
|
||||
@@ -40,7 +40,7 @@ jar {
|
||||
manifestAttributes(manifest, project)
|
||||
}
|
||||
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
|
||||
@@ -40,7 +40,7 @@ jar {
|
||||
manifestAttributes(manifest, project)
|
||||
}
|
||||
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
|
||||
@@ -13,7 +13,8 @@ compileJava {
|
||||
options.fork = false
|
||||
}
|
||||
|
||||
jar {
|
||||
TaskProvider<Jar> jar = tasks.named("jar")
|
||||
jar.configure {
|
||||
manifestAttributes(manifest, project)
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ jar {
|
||||
manifestAttributes(manifest, project)
|
||||
}
|
||||
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDepsToShadedCompiler(project, jar, {}), {})
|
||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
|
||||
Reference in New Issue
Block a user