Skip to content

Commit

Permalink
Merge pull request #4329 from guardian/update-to-java-11
Browse files Browse the repository at this point in the history
Update to Java 11
  • Loading branch information
rtyley authored Sep 24, 2024
2 parents 763ccda + 264b2bd commit b569d60
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 18 deletions.
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
14 changes: 5 additions & 9 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,12 +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-XX:+UseGCLogFileRotation",
"-J-XX:NumberOfGCLogFiles=5",
"-J-XX:GCLogFileSize=2M"
"-J-Xlog:gc*",
s"-J-Xlog:gc:/var/log/$projectName/gc.log"
)
))
//Add the BBC library dependency if defined
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")
/*
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
4 changes: 2 additions & 2 deletions riff-raff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ 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
Recipe: grid-imaging-ARM
Recipe: grid-imaging-java11-ARM
ImgOpsAmiId:
BuiltBy: amigo
AmigoStage: PROD
Expand Down

0 comments on commit b569d60

Please sign in to comment.