Skip to content

Commit 0970a33

Browse files
jbachorikclaude
andcommitted
Fix Gradle 9 implicit dependency for compileJava9Java
Gradle 9 detects that compileJava9Java uses mainSourceSet.output which includes copyExternalLibs destination. Add explicit dependency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a6f77f9 commit 0970a33

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

build-logic/conventions/src/main/kotlin/com/datadoghq/profiler/ProfilerTestPlugin.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,11 @@ class ProfilerTestPlugin : Plugin<Project> {
122122
private fun configureJavaExecTask(task: JavaExec, extension: ProfilerTestExtension, project: Project) {
123123
// Disable Gradle 9 toolchain probing (fails on musl with glibc probe binary)
124124
// Use explicit executable path instead
125+
// Note: Must clear convention AND set value to prevent toolchain resolution
125126
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
126-
task.javaLauncher.set(null as org.gradle.jvm.toolchain.JavaLauncher?)
127+
task.javaLauncher.convention(null as org.gradle.jvm.toolchain.JavaLauncher?)
128+
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
129+
task.javaLauncher.value(null as org.gradle.jvm.toolchain.JavaLauncher?)
127130
task.setExecutable(PlatformUtils.testJavaExecutable())
128131

129132
// JVM arguments for JavaExec tasks

ddprof-lib/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ val copyExternalLibs by tasks.registering(Copy::class) {
8585
}
8686
}
8787

88+
// Gradle 9 requires explicit dependency: compileJava9Java uses mainSourceSet.output
89+
// which includes the copyExternalLibs destination directory
90+
afterEvaluate {
91+
tasks.named("compileJava9Java") {
92+
dependsOn(copyExternalLibs)
93+
}
94+
}
95+
8896
// Create JAR tasks for each build configuration using nativeBuild extension utilities
8997
// Uses afterEvaluate to discover configurations dynamically from NativeBuildExtension
9098
afterEvaluate {

0 commit comments

Comments
 (0)