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

Ld/upgrade to java 21 #109

Merged
merged 5 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v3
Copy link
Member

Choose a reason for hiding this comment

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

It's not really part of this PR, but just spotted we can make this match ci-mobile-save-for-later.yaml:

Suggested change
uses: actions/setup-java@v3
uses: actions/setup-java@v4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah great thank you, I'll make a follow up PR for this.

with:
java-version: 11
java-version: 21
distribution: corretto
cache: sbt

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-mobile-save-for-later.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 21
distribution: corretto
cache: sbt

Expand Down
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ val commonSettings: immutable.Seq[Def.Setting[_]] = List(
"-deprecation",
"-encoding",
"UTF-8",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed this because I was getting an error that -release:21 is not a valid compiler option when I ran the code. Looking at the docs: https://docs.scala-lang.org/overviews/compiler-options/ my understanding is that this is not supported for Java 21.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried on my local machine and it compiled successfully with -release:21 option. Did I miss anything here? (my local Java is 21.0.2-amzn)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah my mistake, yes seems to be working fine for me too now. Perhaps I had been running against an earlier version of Java when I tested it before

Copy link
Contributor

Choose a reason for hiding this comment

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

I also got this error initially and can confirm it went away once I switched to java 21

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, the docs at https://docs.scala-lang.org/overviews/compiler-options/ are unhelpful there - I've opened scala/docs.scala-lang#3009 to try to improve them!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the docs at https://docs.scala-lang.org/overviews/compiler-options/ are unhelpful there - I've opened scala/docs.scala-lang#3009 to try to improve them!

💖

"-release:11",
"-Ypartial-unification",
"-Ywarn-dead-code"
)
Expand Down
8 changes: 4 additions & 4 deletions cdk/lib/__snapshots__/mobile-save-for-later.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ Object {
"Arn",
],
},
"Runtime": "java11",
"Runtime": "java21",
"Tags": Array [
Object {
"Key": "App",
Expand Down Expand Up @@ -993,7 +993,7 @@ Object {
"Arn",
],
},
"Runtime": "java11",
"Runtime": "java21",
"Tags": Array [
Object {
"Key": "App",
Expand Down Expand Up @@ -2029,7 +2029,7 @@ Object {
"Arn",
],
},
"Runtime": "java11",
"Runtime": "java21",
"Tags": Array [
Object {
"Key": "App",
Expand Down Expand Up @@ -2259,7 +2259,7 @@ Object {
"Arn",
],
},
"Runtime": "java11",
"Runtime": "java21",
"Tags": Array [
Object {
"Key": "App",
Expand Down
2 changes: 1 addition & 1 deletion cdk/lib/mobile-save-for-later.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class MobileSaveForLater extends GuStack {
const app = "mobile-save-for-later";

const commonLambdaProps = {
runtime: Runtime.JAVA_11,
runtime: Runtime.JAVA_21,
app,
fileName: `${app}.jar`,
};
Expand Down
3 changes: 2 additions & 1 deletion docs/testing/save-for-later.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@

### Pre-requisites
1) Mobile credentials from [Janus](https://janus.gutools.co.uk/login)
2) Follow the authentication flow as outlined at the [top](#setting-up-oauth-flow)
2) Make sure you have java 21 installed ([SDK man](https://sdkman.io/) is a good package manager)
3) Follow the authentication flow as outlined at the [top](#setting-up-oauth-flow)

* Go to `src/main/scala/com/gu/sfl/local/LocalServer.scala`
* Select the drop down menu to the left of the run button and select `LocalServer` under run configurations
Expand Down
1 change: 1 addition & 0 deletions docs/testing/user-deletion.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

### Pre-requisites
1) Mobile credentials from [Janus](https://janus.gutools.co.uk/login)
2) Make sure you have java 21 installed ([SDK man](https://sdkman.io/) is a good package manager)

* Go to `src/main/scala/local/RunUserDeletionLambda.scala`
* Select the drop down menu to the left of the run button and select `RunUserDeletionLambda` under run configurations
Expand Down
2 changes: 1 addition & 1 deletion mobile-save-for-later-user-deletion/conf/cfn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Resources:
Handler: com.gu.sfl.userdeletion.UserDeletionLambda::handler
MemorySize: 512
Role: !GetAtt UserDeletionRole.Arn
Runtime: java11
Runtime: java21
Timeout: 300
UserDeletionEventSource:
Type: AWS::Lambda::EventSourceMapping
Expand Down
Loading