Skip to content
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

Build ORT with Java 21 #9134

Merged
merged 6 commits into from
Oct 3, 2024
Merged

Build ORT with Java 21 #9134

merged 6 commits into from
Oct 3, 2024

Conversation

sschuberth
Copy link
Member

As fcfab20 decoupled the Java version to use for analysis of Gradle projects from the Java version running ORT, finally update the Java version from 11 / 17 to 21. See 1 for context.

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.10%. Comparing base (d26e12f) to head (ed701c7).
Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9134   +/-   ##
=========================================
  Coverage     67.10%   67.10%           
  Complexity     1187     1187           
=========================================
  Files           240      240           
  Lines          7904     7904           
  Branches        908      908           
=========================================
  Hits           5304     5304           
  Misses         2232     2232           
  Partials        368      368           
Flag Coverage Δ
funTest-docker 60.23% <ø> (ø)
funTest-non-docker 34.56% <ø> (ø)
test 36.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sschuberth sschuberth force-pushed the java-21 branch 10 times, most recently from 4d36091 to aa407af Compare September 20, 2024 17:43
@sschuberth sschuberth changed the title build(gradle): Build with Java 21 Build ORT with Java 21 Sep 20, 2024
@sschuberth sschuberth marked this pull request as ready for review September 20, 2024 17:43
@sschuberth sschuberth requested a review from a team as a code owner September 20, 2024 17:43
@sschuberth sschuberth enabled auto-merge (rebase) September 27, 2024 15:08
@sschuberth sschuberth force-pushed the java-21 branch 2 times, most recently from f315b16 to 109ec00 Compare September 30, 2024 19:10
Use K2 for KSP to make KSP use the Gradle daemon instead of its own [1].
Then also configure the JVM to be used by the Gradle daemon [2], as the
daemon is not affected by the regular toolchains mechanism [3].

Also see [4] for some background information.

[1]: https://github.com/google/ksp/blob/main/docs/ksp2.md#using-ksp-2-in-gradle
[2]: https://docs.gradle.org/current/userguide/gradle_daemon.html#sec:daemon_jvm_criteria
[3]: https://docs.gradle.org/current/userguide/toolchains.html
[4]: google/ksp#740

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Commit 57dc97a wrongly claimed that the Security Manager was removed in
Java 17; it was only deprecated in that version. However, it was removed
in Java 21 without a substitute [1]. Remove a test that depends on the
Security Manager to be able to upgrade to Java 21.

[1]: https://bugs.openjdk.org/browse/JDK-8199704

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
This works around a bug on Fedora Linux where the system "JDK" (that does
not include `javac`) is chosen over a Adoptium / Temurin JDK, which
fails.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Align with `gradle-model` to avoid problems when starting to build all
of ORT with a newer Java version.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
Test projects mostly use Gradle 7.5.1 and 7.4.2 which are incompatible
with modern Java versions like 21. Based on [1], use Java 17 for these
independently of the Java version that runs ORT.

[1]: https://docs.gradle.org/current/userguide/compatibility.html

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
As fcfab20 decoupled the Java version to use for analysis of Gradle
projects from the Java version running ORT, finally update the Java
version from 11 / 17 to 21. See [1] for context.

Also stop using the deprecated `Thread.id` in favor of `Thread.threadId()`
and ensure to run with Java 21 when generating completion scripts.

[1]: #8249

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
@sschuberth sschuberth merged commit ab39b4d into main Oct 3, 2024
23 checks passed
@sschuberth sschuberth deleted the java-21 branch October 3, 2024 07:53
mnonnenmacher added a commit to boschglobal/ort-server that referenced this pull request Oct 7, 2024
With the upgrade of the GitHub action runners to ubuntu-24.04 in
1234567, the default Java version has changed to Java 17 (compare [1]
and [2]). This breaks the build of the analyzer worker build using
JDK 11, because the server code is now built with an incompatible class
file version.

Fix this by switching back to using JDK 11 in the Docker build workflow.
This is only a temporary solution, as the next ORT release will only be
available for Java 21 [3]. With this upgrade the JDK bootstrapping
mechanism introduced in recent ORT releases has to be used, instead of
building analyzer worker images with different JDKs.

[1]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#java
[2]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#java
[3]: oss-review-toolkit/ort#9134

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
github-merge-queue bot pushed a commit to eclipse-apoapsis/ort-server that referenced this pull request Oct 7, 2024
With the upgrade of the GitHub action runners to ubuntu-24.04 in
1234567, the default Java version has changed to Java 17 (compare [1]
and [2]). This breaks the build of the analyzer worker build using
JDK 11, because the server code is now built with an incompatible class
file version.

Fix this by switching back to using JDK 11 in the Docker build workflow.
This is only a temporary solution, as the next ORT release will only be
available for Java 21 [3]. With this upgrade the JDK bootstrapping
mechanism introduced in recent ORT releases has to be used, instead of
building analyzer worker images with different JDKs.

[1]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#java
[2]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#java
[3]: oss-review-toolkit/ort#9134

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
kamil-bielecki-bosch pushed a commit to boschglobal/ort-server that referenced this pull request Oct 11, 2024
With the upgrade of the GitHub action runners to ubuntu-24.04 in
1234567, the default Java version has changed to Java 17 (compare [1]
and [2]). This breaks the build of the analyzer worker build using
JDK 11, because the server code is now built with an incompatible class
file version.

Fix this by switching back to using JDK 11 in the Docker build workflow.
This is only a temporary solution, as the next ORT release will only be
available for Java 21 [3]. With this upgrade the JDK bootstrapping
mechanism introduced in recent ORT releases has to be used, instead of
building analyzer worker images with different JDKs.

[1]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#java
[2]: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#java
[3]: oss-review-toolkit/ort#9134

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants