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:
Ilya Chernikov
2019-08-14 11:35:52 +02:00
parent f74c4fa538
commit 0f41dc814f
29 changed files with 77 additions and 69 deletions
+1 -1
View File
@@ -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)
}
))
@@ -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 {
+1 -1
View File
@@ -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