-
Notifications
You must be signed in to change notification settings - Fork 104
ci: java8 build with java11 compilation #1671
Conversation
d548a55 to
1068273
Compare
1068273 to
20da203
Compare
088b709 to
96b5ca2
Compare
96b5ca2 to
c4c6999
Compare
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-java@v3 | ||
| with: | ||
| java-version: 8 | ||
| distribution: zulu | ||
| - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV | ||
| - uses: actions/setup-java@v3 | ||
| with: | ||
| java-version: 11 | ||
| distribution: zulu | ||
| - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV |
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.
This job now requires 2 JDKs.
.kokoro/build.sh
Outdated
| echo "Compiling using Java:" | ||
| java -version | ||
| echo | ||
| ./gradlew compileJava compileTestJava |
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.
This doesn't run tests.
.kokoro/build.sh
Outdated
| ./gradlew build publishToMavenLocal \ | ||
| --exclude-task compileJava --exclude-task compileTestJava |
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.
This runs tests without re-compiling.
build.gradle
Outdated
| // This flag is only available in JDK 9+ | ||
| options.compilerArgs.addAll(['--release', '8']) |
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.
This flag ensures the generated bytecode is compatible with Java 8. (targetCompatibility = 1.8 is not sufficient)
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.
Could we make this a source code comment?
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.
Added
dependencies.properties
Outdated
| maven.javax_annotation_javax_annotation_api=javax.annotation:javax.annotation-api:1.3.2 | ||
| maven.org_graalvm_nativeimage_svm=org.graalvm.nativeimage:svm:22.0.0.2 | ||
| maven.org_graalvm_sdk=org.graalvm.sdk:graal-sdk:21.3.2 | ||
| maven.org_graalvm_sdk=org.graalvm.sdk:graal-sdk:22.1.0 |
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.
This is the dependency that was failing Java 8 build #1669
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.
Not actionable: Given the new behavior introduced in 22.1.0, this might cause some of our Kokoro GraalVM builds to be temporarily red.
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.
I missed to remove this. This was a test to confirm the build passes. Reverted in this PR.
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.
Ah got it, thanks.
ae4f9a0 to
a377d1d
Compare
|
@mpeddada1 @meltsufin It worked. Building the modules in JDK 11 and running tests in Java 8.
|
|
That's wonderful news! |
build.gradle
Outdated
| // This flag is only available in JDK 9+ | ||
| options.compilerArgs.addAll(['--release', '8']) |
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.
Could we make this a source code comment?
dependencies.properties
Outdated
| maven.javax_annotation_javax_annotation_api=javax.annotation:javax.annotation-api:1.3.2 | ||
| maven.org_graalvm_nativeimage_svm=org.graalvm.nativeimage:svm:22.0.0.2 | ||
| maven.org_graalvm_sdk=org.graalvm.sdk:graal-sdk:21.3.2 | ||
| maven.org_graalvm_sdk=org.graalvm.sdk:graal-sdk:22.1.0 |
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.
Not actionable: Given the new behavior introduced in 22.1.0, this might cause some of our Kokoro GraalVM builds to be temporarily red.
mpeddada1
left a comment
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.
LGTM. Added a few minor comments!
.kokoro/build.sh
Outdated
| export PATH=${JAVA_HOME}/bin:$PATH | ||
| } | ||
|
|
||
| # GraalVM dependencies require to compiling the classes in JDK 11 or higher |
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.
Should there be an explicit check that JDK 11 or higher and JDK 8 are configured, and fail otherwise?
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.
I added source code comment here about how it fails in Java 8.
6eb83ad to
1e21d5b
Compare
1e21d5b to
636c5e5
Compare
meltsufin
left a comment
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.
My concern is that if you intend to test with Java 8, but forget to configure it correctly, you won't see any failure. Maybe you can add an argument to the script that specifies compilation JDK and runtime JVM version, so that you can validate that the script actually does what's intended by the caller.
|
Kudos, SonarCloud Quality Gate passed! |
|
@meltsufin PTAL. Added a check to confirm it's using JDK 8 for running the Java 8 test. |








Uh oh!
There was an error while loading. Please reload this page.