Skip to content

Commit 7387d63

Browse files
committed
chore: Configure lazily :buildSrc:call-site-instrumentation-plugin tasks
1 parent 36490a6 commit 7387d63

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

buildSrc/call-site-instrumentation-plugin/build.gradle.kts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,41 +52,39 @@ sourceSets {
5252
}
5353
}
5454

55-
val copyCallSiteSources = tasks.register<Copy>("copyCallSiteSources") {
56-
val csiPackage = "datadog/trace/agent/tooling/csi"
57-
val source = layout.projectDirectory.file("../../dd-java-agent/agent-tooling/src/main/java/$csiPackage")
58-
val target = layout.buildDirectory.dir("generated/sources/csi/$csiPackage")
59-
doFirst {
60-
val folder = target.get().asFile
61-
if (folder.exists() && !folder.deleteRecursively()) {
62-
throw GradleException("Cannot delete files in $folder")
55+
tasks {
56+
val copyCallSiteSources = register<Copy>("copyCallSiteSources") {
57+
val csiPackage = "datadog/trace/agent/tooling/csi"
58+
val source = layout.projectDirectory.file("../../dd-java-agent/agent-tooling/src/main/java/$csiPackage")
59+
val target = layout.buildDirectory.dir("generated/sources/csi/$csiPackage")
60+
doFirst {
61+
val folder = target.get().asFile
62+
if (folder.exists() && !folder.deleteRecursively()) {
63+
throw GradleException("Cannot delete files in $folder")
64+
}
6365
}
66+
from(source)
67+
into(target)
68+
group = "build"
6469
}
65-
from(source)
66-
into(target)
67-
group = "build"
68-
}
6970

70-
tasks {
71-
withType<AbstractCompile> {
71+
withType<AbstractCompile>().configureEach {
7272
dependsOn(copyCallSiteSources)
7373
}
74-
}
7574

76-
tasks {
77-
named<ShadowJar>("shadowJar") {
75+
shadowJar {
7876
mergeServiceFiles()
7977
manifest {
8078
attributes(mapOf("Main-Class" to "datadog.trace.plugin.csi.PluginApplication"))
8179
}
8280
}
83-
}
8481

85-
tasks.build {
86-
dependsOn(tasks.shadowJar)
87-
}
82+
build {
83+
dependsOn(shadowJar)
84+
}
8885

89-
tasks.test {
90-
useJUnitPlatform()
91-
enabled = project.hasProperty("runBuildSrcTests")
86+
test {
87+
useJUnitPlatform()
88+
enabled = project.hasProperty("runBuildSrcTests")
89+
}
9290
}

0 commit comments

Comments
 (0)