From 5366ecad00a4e76db0c81bfb8173f7531c5698ce Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Mon, 2 Oct 2023 14:11:00 +0200 Subject: [PATCH] chore: Drop JDK 8 (#1058) --- .github/workflows/check-build-test.yml | 1 - .github/workflows/publish.yml | 8 +++----- build.sbt | 22 +++++++++------------- project/Common.scala | 12 +++++++++++- project/project-info.conf | 2 +- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/check-build-test.yml b/.github/workflows/check-build-test.yml index 358618bd..609badc0 100644 --- a/.github/workflows/check-build-test.yml +++ b/.github/workflows/check-build-test.yml @@ -89,7 +89,6 @@ jobs: fail-fast: false matrix: include: - - { jdk: 'adopt:8', container: "cassandra-latest", test: "test" } - { jdk: 'temurin:1.11.0.17', container: "cassandra-latest", test: "test" } - { jdk: 'temurin:1.11.0.17', container: "cassandra2", test: "'testOnly -- -l RequiresCassandraThree'"} - { jdk: 'temurin:1.11.0.17', container: "cassandra3", test: "test" } diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c1d9337d..004b02d6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,12 +28,10 @@ jobs: # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves fetch-depth: 0 - - name: Setup JDK 8 - # https://github.com/coursier/setup-action/releases - # v1.3.0 - uses: coursier/setup-action@70323223454ac2a9eb2de46f389b4d045cbcdea5 + - name: Set up JDK 11 + uses: coursier/setup-action@v1.3.0 with: - java-version: adopt:1.8.0-275 + jvm: temurin:1.11.0.17 - name: Cache Coursier cache # https://github.com/coursier/cache-action/releases/ diff --git a/build.sbt b/build.sbt index e26c1b22..073b613a 100644 --- a/build.sbt +++ b/build.sbt @@ -35,7 +35,7 @@ lazy val endToEndExample = project .dependsOn(core) .settings(libraryDependencies ++= Dependencies.exampleDependencies, publish / skip := true) .settings( - dockerBaseImage := "openjdk:8-jre-alpine", + dockerBaseImage := "docker.io/library/eclipse-temurin:17.0.8.1_1-jre", dockerCommands := dockerCommands.value.flatMap { case ExecCmd("ENTRYPOINT", args @ _*) => Seq(Cmd("ENTRYPOINT", args.mkString(" "))) @@ -46,18 +46,7 @@ lazy val endToEndExample = project dockerUpdateLatest := true, // update if deploying to some where that can't see docker hu //dockerRepository := Some("some-registry"), - dockerCommands ++= Seq( - Cmd("USER", "root"), - Cmd("RUN", "/sbin/apk", "add", "--no-cache", "bash", "bind-tools", "busybox-extras", "curl", "iptables"), - Cmd( - "RUN", - "/sbin/apk", - "add", - "--no-cache", - "jattach", - "--repository", - "http://dl-cdn.alpinelinux.org/alpine/edge/community/"), - Cmd("RUN", "chgrp -R 0 . && chmod -R g=u .")), + dockerCommands ++= Seq(Cmd("USER", "root"), Cmd("RUN", "chgrp -R 0 . && chmod -R g=u .")), // Docker image is only for running in k8s Universal / javaOptions ++= Seq("-J-Dconfig.resource=kubernetes.conf")) .enablePlugins(DockerPlugin, JavaAppPackaging) @@ -123,3 +112,10 @@ TaskKey[Unit]("verifyCodeFmt") := { } addCommandAlias("verifyCodeStyle", "headerCheckAll; verifyCodeFmt") + +val isJdk11orHigher: Boolean = { + val result = VersionNumber(sys.props("java.specification.version")).matchesSemVer(SemanticSelector(">=11")) + if (!result) + throw new IllegalArgumentException("JDK 11 or higher is required") + result +} diff --git a/project/Common.scala b/project/Common.scala index 6ab39d22..ffdc1327 100644 --- a/project/Common.scala +++ b/project/Common.scala @@ -50,7 +50,17 @@ object Common extends AutoPlugin { crossVersion := CrossVersion.binary, crossScalaVersions := Dependencies.Scala2Versions, scalaVersion := Dependencies.Scala213, - scalacOptions ++= Seq("-encoding", "UTF-8", "-feature", "-unchecked", "-Xlint", "-Ywarn-dead-code", "-deprecation"), + javacOptions ++= Seq("--release", "11"), + scalacOptions ++= Seq( + "-encoding", + "UTF-8", + "-feature", + "-unchecked", + "-Xlint", + "-Ywarn-dead-code", + "-deprecation", + "-release", + "11"), Compile / console / scalacOptions --= Seq("-deprecation", "-Xfatal-warnings", "-Xlint", "-Ywarn-unused:imports"), Compile / doc / scalacOptions := scalacOptions.value ++ Seq( "-doc-title", diff --git a/project/project-info.conf b/project/project-info.conf index 3f5634ff..a664722c 100644 --- a/project/project-info.conf +++ b/project/project-info.conf @@ -1,7 +1,7 @@ project-info { version: "current" shared-info { - jdk-versions: ["Adopt OpenJDK 8", "Adopt OpenJDK 11"] + jdk-versions: ["Eclipse Temurin JDK 11", "Eclipse Temurin JDK 17"] snapshots: { url: "https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/akka/akka-persistence-cassandra_2.13/" text: "Snapshots are available from Sonatype"