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

compile and run against java 21 LTS #2195

Merged
merged 4 commits into from
Mar 14, 2024
Merged

compile and run against java 21 LTS #2195

merged 4 commits into from
Mar 14, 2024

Conversation

johnduffell
Copy link
Member

@johnduffell johnduffell commented Mar 13, 2024

Further to updating to arm64 architecture #2194

This PR updates to java 21 LTS. This seems to have bumped performance significantly with support-workers guardian/support-frontend#5792 , so I am replicating it here.

I have also bumped the version we compile with in GHA, in case that improves compilation performance.

I tested auto cancel in CODE and it seems to have improved the cold start noticably

@@ -9,7 +9,6 @@ val scala2Settings = Seq(
"-encoding",
"UTF-8",
"-feature",
"-target:jvm-1.8",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this parameter was causing a lot of warnings, also it wasn't really relevant any more. It would only be needed if we were compiling on a later VM and running on an earlier one.

Comment on lines +862 to +863
sys.props("java.specification.version") == "21",
"Java 21 is required for this project, download corretto-21 from File->Project structure.",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen problems locally where people have been on a later version than is supported by either SBT/play/scala, so I have kept this in and updated it.
If it's causing issues locally we can rethink.

@johnduffell johnduffell requested review from tjmw and tomrf1 March 13, 2024 14:37
@johnduffell johnduffell merged commit 45c4661 into main Mar 14, 2024
38 checks passed
@johnduffell johnduffell deleted the jd-java21 branch March 14, 2024 09:20
@rtyley
Copy link
Member

rtyley commented Mar 14, 2024

Looks like we need to bump the version of Java used by our Scala Steward workflow as well:

https://github.com/guardian/scala-steward-public-repos/actions/runs/8278707245/job/22651625930

java.lang.AssertionError: assertion failed: Java 21 is required for this project, download corretto-21 from File->Project structure.
at scala.Predef$.assert(Predef.scala:223)
at $cd99ddf78d62fbdae579$.$anonfun$$sbtdef$1(/home/runner/scala-steward/workspace/repos/guardian/support-service-lambdas/build.sbt:863)
at $cd99ddf78d62fbdae579$.$anonfun$$sbtdef$1$adapted(/home/runner/scala-steward/workspace/repos/guardian/support-service-lambdas/build.sbt:859)
at scala.Function1.$anonfun$compose$1(Function1.scala:49)

@johnduffell
Copy link
Member Author

good spot @rtyley I have raised a PR to update scala steward, however it is likely to fail on other projects where they are not up to recent versions of sbt, it's needing 2.12.18 or later to work https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html

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.

None yet

3 participants