-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix verifyJavaVersion in a few places #32183
Conversation
Run SQL_Java8 PreCommit https://github.com/apache/beam/actions/runs/10393016359 now runs
|
Run SQL_Java17 PreCommit https://github.com/apache/beam/actions/runs/10393018367 now runs
|
@@ -40,15 +40,15 @@ dependencies { | |||
provided library.java.jmh_core | |||
|
|||
testImplementation library.java.junit | |||
testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadowTest") | |||
testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadow") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shadowTest currently does not work on Java21 tests because shadow plugin does not support Java21:
org.gradle.api.GradleException: Could not add file '/Users/yathu/beam/sdks/java/core/build/classes/java/test/DefaultPackageTest$MyFn.class' to ZIP '/Users/yathu/beam/sdks/java/core/build/libs/beam-sdks-java-core-2.59.0-SNAPSHOT-tests.jar'.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65
at shadow.org.objectweb.asm.ClassReader.<init>(ClassReader.java:199)
at shadow.org.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
at shadow.org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
at shadow.org.objectweb.asm.ClassReader.<init>(ClassReader.java:287)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:72)
here "shadow" configuration is sufficient (like other tests runs pipeline on direct runner)
PreCommit Java Example Java21 now verifies java version: https://github.com/apache/beam/actions/runs/10393658121?pr=32183
|
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
assign set of reviewers |
Assigning reviewers. If you would like to opt out of this review, comment R: @m-trieu for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
['8', '11', '17', '21'].each { | ||
tasks.create(name: "verifyJavaVersion${it}", type: Test) { | ||
['8', '11', '17', '21'].each { String ver -> | ||
tasks.create(name: "verifyJavaVersion${ver}", type: Test) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Groovy has a many implicit and errorprone syntax and this is one of it. Foreach closure has an implicit variable that has default name it
. However, the tasks.create closure override the same name, causing "${it}" resolved to "Task " and as a result, only verifyCodeIsCompiledWithJava8 was run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof. good catch.
The latest commit should fix https://github.com/apache/beam/actions/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml currently failing on master |
Run Xlang_Generated_Transforms PreCommit update: https://github.com/apache/beam/actions/runs/10395162471/job/28786672477 pased |
Two issues
It is found that after Setup Java 21 container #28918, the java version verification test only checks that the source code was compile with Java8, but not test code compiled/running on certain Java version
We had overly strict sdks:java:docker:javaX:validateJavaHome . If system java version is Java11, xlangPythonUsingJava will add a java 11 docker task, which currently requires
-Pjava11Home
, which is not necessary.Please add a meaningful description for your change here
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123
), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.