From 193e0abedb438c8c738554f89312b635b69244d7 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Thu, 9 Jul 2026 12:20:26 +0200 Subject: [PATCH 1/2] 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 ``` --- dd-java-agent/build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dd-java-agent/build.gradle b/dd-java-agent/build.gradle index 38b686c76ab..f50dd2b6e46 100644 --- a/dd-java-agent/build.gradle +++ b/dd-java-agent/build.gradle @@ -347,8 +347,11 @@ def generateAgentJarIndex = tasks.register('generateAgentJarIndex', JavaExec) { it.mainClass = 'datadog.trace.bootstrap.AgentJarIndex$IndexGenerator' it.inputs.files(includedJarFileTree) - it.inputs.files(it.classpath) + .withPropertyName("includedAgentFiles") + .withPathSensitivity(PathSensitivity.RELATIVE) it.outputs.dir(destinationDir) + .withPropertyName("agentJarIndex") + it.outputs.cacheIf { true } it.classpath = objects.fileCollection().tap { it.from(project.configurations.named("shadowInclude")) it.from(project.configurations.named('slf4j-simple')) From f46f26b0f97abda24fbb6081adc50c74a93c0dd7 Mon Sep 17 00:00:00 2001 From: Brice Dutheil Date: Thu, 9 Jul 2026 12:57:05 +0200 Subject: [PATCH 2/2] 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. --- dd-java-agent/instrumentation/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dd-java-agent/instrumentation/build.gradle b/dd-java-agent/instrumentation/build.gradle index a3e8ddc83c4..644a5dcd58c 100644 --- a/dd-java-agent/instrumentation/build.gradle +++ b/dd-java-agent/instrumentation/build.gradle @@ -153,8 +153,9 @@ TaskProvider registerIndexTask(String indexTaskName, String indexer, S it.from(project.configurations.named("runtimeClasspath")) it.from(project.configurations.named('slf4j-simple')) } - it.inputs.files(it.classpath) it.outputs.dir(destinationDir) + .withPropertyName("indexDirectory") + it.outputs.cacheIf { true } it.argumentProviders.add(new CommandLineArgumentProvider() { @Override Iterable asArguments() {