Skip to content

Commit a4d701e

Browse files
Fix :buildSrc:test by resolving Linux arm64 platform check lazily
BuildPlatform relies on Gradle's native services, which are unavailable when configuring tasks under ProjectBuilder in unit tests. Evaluating project.isLinuxArm64() eagerly during test-task configuration made TestJvmConstraintsPluginTest fail with NativeIntegrationUnavailableException. Defer the check to execution time via the existing lazy additionalCondition on ProvideJvmArgsOnJvmLauncherVersion, keeping it out of the configuration path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1e66139 commit a4d701e

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

buildSrc/src/main/kotlin/datadog/gradle/plugin/testJvmConstraints/TestJvmConstraintsPlugin.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,11 @@ class TestJvmConstraintsPlugin : Plugin<Project> {
9090

9191
// Fix for Linux arm64 ByteBuddy error:
9292
// "Could not self-attach to current VM using external process"
93-
if (project.isLinuxArm64()) {
94-
conditionalJvmArgs(
95-
JavaVersion.VERSION_1_9,
96-
listOf("-Djdk.attach.allowAttachSelf=true")
97-
)
98-
}
93+
conditionalJvmArgs(
94+
JavaVersion.VERSION_1_9,
95+
listOf("-Djdk.attach.allowAttachSelf=true"),
96+
project.providers.provider { project.isLinuxArm64() }
97+
)
9998
}
10099

101100
/**

0 commit comments

Comments
 (0)