Skip to content

Commit 035792b

Browse files
authored
Merge pull request #465 from gradle/snoopcheri/configure-jdk-25
Fix for finding Java 25 toolchain in tests on CI
2 parents 4ac9713 + 864d6cf commit 035792b

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.teamcity/settings.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ project {
3737
params {
3838
java8Home(Os.linux)
3939
java17Home(Os.linux)
40+
java25Home(Os.linux)
4041
text("systemProp.org.gradle.internal.publish.checksums.insecure", "true")
4142
}
4243

.teamcity/settings/extensions.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ fun ParametrizedWithType.java17Home(os: Os) {
2626
param("env.JDK17", "%${os.name}.java17.openjdk.64bit%")
2727
}
2828

29+
fun ParametrizedWithType.java25Home(os: Os) {
30+
// Currently hard-coded for Linux
31+
param("env.JDK25", "/opt/jdk/open-jdk-25")
32+
}
33+
2934
const val useGradleInternalScansServer = "-I gradle/init-scripts/build-scan.init.gradle.kts"
3035

3136
const val buildCacheSetup = "--build-cache -Dgradle.cache.remote.push=true"
@@ -57,6 +62,7 @@ fun Project.buildType(buildTypeName: String, init: BuildType.() -> Unit): BuildT
5762
params {
5863
java8Home(Os.linux)
5964
java17Home(Os.linux)
65+
java25Home(Os.linux)
6066

6167
param("env.GRADLE_CACHE_REMOTE_URL", "%gradle.cache.remote.url%")
6268
param("env.GRADLE_CACHE_REMOTE_USERNAME", "%gradle.cache.remote.username%")

plugin/src/test/groovy/org/gradle/testretry/AbstractPluginFuncTest.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,23 @@ abstract class AbstractPluginFuncTest extends Specification implements TestFrame
3737
@Rule
3838
TemporaryFolder testProjectDir = new TemporaryFolder()
3939

40+
File gradleProperties
41+
4042
File settingsFile
4143

4244
File buildFile
4345

4446
def setup() {
47+
gradleProperties = testProjectDir.newFile('gradle.properties')
48+
testJavaToolchainVersion().ifPresent { major ->
49+
// When a specific Java version is specified that tests should configure,
50+
// we have to configure the build to allow finding the version via an env variable.
51+
def expectedEnvVar = "JDK${major}"
52+
assert (System.getenv(expectedEnvVar) != null) : "Test toolchain version is configured but env var ${expectedEnvVar} is missing!"
53+
54+
gradleProperties << "org.gradle.java.installations.fromEnv=${expectedEnvVar}"
55+
}
56+
4557
settingsFile = testProjectDir.newFile('settings.gradle')
4658
settingsFile << "rootProject.name = 'hello-world'"
4759
buildFile = testProjectDir.newFile('build.gradle')

0 commit comments

Comments
 (0)