Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class TestJvmConstraintsPlugin : Plugin<Project> {
"vendor" to vendor,
"runtimeVersion" to javaRuntimeVersion,
"vmVersion" to jvmVersion,
"operatingSystem" to System.getProperty("os.name"),
"architecture" to System.getProperty("os.arch"),
Comment thread
bric3 marked this conversation as resolved.
Comment thread
bric3 marked this conversation as resolved.
)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.junit.jupiter.params.provider.ValueSource

class TestJvmCacheInputsTest : GradleFixture() {
@ParameterizedTest
@ValueSource(strings = ["vendor", "runtimeVersion", "vmVersion"])
@ValueSource(strings = ["vendor", "runtimeVersion", "vmVersion", "os.name", "os.arch"])
fun `test cache follows the selected launcher identity`(changedField: String) {
writeSettings(
"""
Expand Down Expand Up @@ -50,10 +50,15 @@ class TestJvmCacheInputsTest : GradleFixture() {
}

val launcher = javaToolchains.launcherFor {}
val changedField = providers.gradleProperty("changedJvmField").orElse("")
val changedField = providers.gradleProperty("changedJvmField").orNull
if (changedField?.startsWith("os.") == true) {
val original = System.getProperty(changedField)
System.setProperty(changedField, "different-platform")
gradle.buildFinished { System.setProperty(changedField, original) }
}
tasks.test {
useJUnitPlatform()
javaLauncher.set(launcher.map { SelectedLauncher(it, changedField.get()) })
javaLauncher.set(launcher.map { SelectedLauncher(it, changedField ?: "") })
}
"""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class TestJvmConstraintsPluginTest {
"vendor" to metadata.vendor,
"runtimeVersion" to metadata.javaRuntimeVersion,
"vmVersion" to metadata.jvmVersion,
"operatingSystem" to System.getProperty("os.name"),
"architecture" to System.getProperty("os.arch"),
))
}

Expand Down
2 changes: 1 addition & 1 deletion docs/how_to_work_with_gradle.md
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ This project provides several custom Gradle extensions to manage multi-JVM testi

Controls which JVM versions are allowed to run tests. Applied via the `dd-trace-java.test-jvm-constraints` plugin.

Each `Test` task also tracks its selected JVM's vendor, full runtime version and VM version as inputs.
Each `Test` task also tracks its selected JVM's vendor, full runtime version, VM version, operating system, and architecture as inputs.
Changing these values invalidates up-to-date checks and build-cache entries, even when the Java major version stays the same.

```Gradle Kotlin DSL
Expand Down
Loading