Skip to content

Commit 2a44ea8

Browse files
committed
fix gemini
1 parent ee83cc9 commit 2a44ea8

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,15 @@ class BeamModulePlugin implements Plugin<Project> {
507507

508508
project.ext.mavenGroupId = 'org.apache.beam'
509509

510-
if (!project.hasProperty('java17Home') && System.getenv('JAVA_HOME_17_X64')) {
511-
project.ext.java17Home = System.getenv('JAVA_HOME_17_X64')
512-
}
513-
if (!project.hasProperty('java11Home') && System.getenv('JAVA_HOME_11_X64')) {
514-
project.ext.java11Home = System.getenv('JAVA_HOME_11_X64')
515-
}
516-
if (!project.hasProperty('java21Home') && System.getenv('JAVA_HOME_21_X64')) {
517-
project.ext.java21Home = System.getenv('JAVA_HOME_21_X64')
510+
['11', '17', '21', '25'].each { version ->
511+
def propName = "java${version}Home"
512+
if (!project.hasProperty(propName)) {
513+
def home = System.getenv("JAVA_HOME_${version}_X64") ?:
514+
(System.getenv("JAVA_HOME_${version}_ARM64") ?: System.getenv("JAVA_HOME_${version}_arm64"))
515+
if (home) {
516+
project.ext.set(propName, home)
517+
}
518+
}
518519
}
519520

520521
// Default to dash-separated directories for artifact base name,
@@ -1655,6 +1656,10 @@ class BeamModulePlugin implements Plugin<Project> {
16551656
useJUnit()
16561657
executable = "${testJavaHome}/bin/java"
16571658
}
1659+
// redirect java exec tasks (expansion service, run, shadowJar execs) to specified JDK
1660+
project.tasks.withType(JavaExec).configureEach {
1661+
executable = "${testJavaHome}/bin/java"
1662+
}
16581663
}
16591664

16601665
if (configuration.shadowClosure) {

0 commit comments

Comments
 (0)