Skip to content

Commit 461d3e8

Browse files
authored
Make index tasks cacheable and improve input fingerprinting (#11896)
chore(build): Make `agentJarIndex` task cacheable Also, it improves the way gradle fingerprints the input The class path is already declared as an input if the JavaExec spec, and doesn't need an additinal declaration. The included dir is `dd-java-agent/build/generated/included` we don't really care about `included/` or where it is, but the task cares about what's below, like `inst/foo/Bar.classdata`. So the idea is to tell gradle to apply that normalization for fingerprinting. https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/PathSensitivity.html#RELATIVE Additional note, that in CI the build dir of projects is relocated under ``` ..../workspace/dd-java-agent/build ``` chore(build): Make instrumentation index tasks cacheable The class path is already declared as an input if the JavaExec spec, and doesn't need an additinal declaration. Co-authored-by: brice.dutheil <brice.dutheil@datadoghq.com>
1 parent 296ad7f commit 461d3e8

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

dd-java-agent/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,11 @@ def generateAgentJarIndex = tasks.register('generateAgentJarIndex', JavaExec) {
348348
it.mainClass = 'datadog.trace.bootstrap.AgentJarIndex$IndexGenerator'
349349

350350
it.inputs.files(includedJarFileTree)
351-
it.inputs.files(it.classpath)
351+
.withPropertyName("includedAgentFiles")
352+
.withPathSensitivity(PathSensitivity.RELATIVE)
352353
it.outputs.dir(destinationDir)
354+
.withPropertyName("agentJarIndex")
355+
it.outputs.cacheIf { true }
353356
it.classpath = objects.fileCollection().tap {
354357
it.from(project.configurations.named("shadowInclude"))
355358
it.from(project.configurations.named('slf4j-simple'))

dd-java-agent/instrumentation/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ TaskProvider<JavaExec> registerIndexTask(String indexTaskName, String indexer, S
153153
it.from(project.configurations.named("runtimeClasspath"))
154154
it.from(project.configurations.named('slf4j-simple'))
155155
}
156-
it.inputs.files(it.classpath)
157156
it.outputs.dir(destinationDir)
157+
.withPropertyName("indexDirectory")
158+
it.outputs.cacheIf { true }
158159
it.argumentProviders.add(new CommandLineArgumentProvider() {
159160
@Override
160161
Iterable<String> asArguments() {

0 commit comments

Comments
 (0)