gemini-code-assist[bot] commented on code in PR #38974:
URL: https://github.com/apache/beam/pull/38974#discussion_r3429875782
##########
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy:
##########
@@ -507,6 +507,16 @@ class BeamModulePlugin implements Plugin<Project> {
project.ext.mavenGroupId = 'org.apache.beam'
+ if (!project.hasProperty('java17Home') &&
System.getenv('JAVA_HOME_17_X64')) {
+ project.ext.java17Home = System.getenv('JAVA_HOME_17_X64')
+ }
+ if (!project.hasProperty('java11Home') &&
System.getenv('JAVA_HOME_11_X64')) {
+ project.ext.java11Home = System.getenv('JAVA_HOME_11_X64')
+ }
+ if (!project.hasProperty('java21Home') &&
System.getenv('JAVA_HOME_21_X64')) {
+ project.ext.java21Home = System.getenv('JAVA_HOME_21_X64')
+ }
Review Comment:

The current implementation only checks for `_X64` suffixed environment
variables (e.g., `JAVA_HOME_17_X64`). On ARM64 runners (such as Apple Silicon
Macs or ARM64 GitHub Actions runners), `actions/setup-java` sets environment
variables with the `_ARM64` suffix (e.g., `JAVA_HOME_17_ARM64`).\n\nTo ensure
compatibility across both x64 and ARM64 architectures, we should check both
suffixes. We can also simplify and DRY up this block using a loop in Groovy.
```
['11', '17', '21'].each { version ->\n def propName =
"java${version}Home"\n if (!project.hasProperty(propName)) {\n def
home = System.getenv("JAVA_HOME_${version}_X64") ?:
System.getenv("JAVA_HOME_${version}_ARM64")\n if (home) {\n
project.ext[propName] = home\n }\n }\n }
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]