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

Update to Java 11 #4329

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
sudo apt-get -y install graphicsmagick-imagemagick-compat
sudo apt-get -y install exiftool
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '8'
java-version: '11'
distribution: 'corretto'
cache: 'sbt'
- name: SBT
Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8
11
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java corretto-11.0.24.8.1
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this file for?

Copy link
Member Author

@rtyley rtyley Sep 20, 2024

Choose a reason for hiding this comment

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

This is an asdf-formatted .tool-versions file - I'm trying to nudge people towards standardising on it (see guardian/gha-scala-library-release-workflow#36) and thought I'd add it in here. It does a very similar job to the .java-version file that's already in the project, which I think is a jEnv thing.

11 changes: 5 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import com.typesafe.sbt.packager.debian.JDebPackaging
ThisBuild / packageOptions += FixedTimestamp(Package.keepTimestamps)

val commonSettings = Seq(
scalaVersion := "2.12.15",
scalaVersion := "2.12.20",
description := "grid",
organization := "com.gu",
version := "0.1",
scalacOptions ++= Seq("-feature", "-deprecation", "-language:higherKinds", "-Xfatal-warnings"),
scalacOptions ++= Seq("-feature", "-deprecation", "-language:higherKinds", "-Xfatal-warnings", "-release:11"),

// The Java SDK uses CBOR protocol
// We use localstack in TEST. Kinesis in localstack uses kinesislite which requires CBOR to be disabled
Expand Down Expand Up @@ -220,7 +220,7 @@ def playProject(projectName: String, port: Int, path: Option[String] = None): Pr
.dependsOn(restLib)
.settings(commonSettings ++ buildInfo ++ Seq(
playDefaultPort := port,
debianPackageDependencies := Seq("openjdk-8-jre-headless"),
debianPackageDependencies := Seq("java11-runtime-headless"),
Linux / maintainer := "Guardian Developers <[email protected]>",
Linux / packageSummary := description.value,
packageDescription := description.value,
Expand All @@ -244,9 +244,8 @@ def playProject(projectName: String, port: Int, path: Option[String] = None): Pr
"-Dpidfile.path=/dev/null",
s"-Dconfig.file=/usr/share/$projectName/conf/application.conf",
s"-Dlogger.file=/usr/share/$projectName/conf/logback.xml",
"-J-XX:+PrintGCDetails",
"-J-XX:+PrintGCDateStamps",
s"-J-Xloggc:/var/log/$projectName/gc.log",
"-J-Xlog:gc*",
s"-J-Xlog:gc:/var/log/$projectName/gc.log",
"-J-XX:+UseGCLogFileRotation",
"-J-XX:NumberOfGCLogFiles=5",
"-J-XX:GCLogFileSize=2M"
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.2
sbt.version=1.10.1
18 changes: 15 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4")

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2")

// needed by Snyk to accurately report vulnerabilities
// https://docs.snyk.io/scan-application-code/snyk-open-source/snyk-open-source-supported-languages-and-package-managers/snyk-for-scala
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
Comment on lines -17 to -19
Copy link
Member Author

Choose a reason for hiding this comment

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

/*
Without setting VersionScheme.Always here on `scala-xml`, sbt 1.8.0 will raise fatal 'version conflict' errors when
used with sbt plugins like `sbt-native-packager`, which currently use sort-of-incompatible versions of the `scala-xml`
library. sbt 1.8.0 has upgraded to Scala 2.12.17, which has itself upgraded to `scala-xml` 2.1.0
(see https://github.com/sbt/sbt/releases/tag/v1.8.0), but `sbt-native-packager` is currently using `scala-xml` 1.1.1,
and the `scala-xml` library declares that it uses specifically 'early-semver' version compatibility (see
https://www.scala-lang.org/blog/2021/02/16/preventing-version-conflicts-with-versionscheme.html#versionscheme-librarydependencyschemes-and-sbt-150 ),
meaning that for version x.y.z, `x` & `y` *must match exactly* for versions to be considered compatible by sbt.
By setting VersionScheme.Always here on `scala-xml`, we're overriding its declared version-compatability scheme,
choosing to tolerate the risk of binary incompatibility. We consider this to be safe because when set under
`projects/` (ie *not* in `build.sbt` itself) it only affects the compilation of build.sbt, not of the application
build itself. Once the build has succeeded, there is no further risk (ie of a runtime exception due to clashing
versions of `scala-xml`).
*/
libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
2 changes: 1 addition & 1 deletion riff-raff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ deployments:
AmiId:
BuiltBy: amigo
AmigoStage: PROD
Recipe: editorial-tools-focal-java8-ARM-WITH-cdk-base
Recipe: editorial-tools-focal-java11-ARM-WITH-cdk-base
ImagingAmiId:
BuiltBy: amigo
AmigoStage: PROD
Expand Down
Loading