From 88569af1e22f9d6ada13eb0849c5276cd755fdc8 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Tue, 15 Sep 2026 09:00:58 +0200 Subject: [PATCH] Build Scala 3 artifacts with 3.3 and test newer versions Use Scala 3.3 as the canonical publishing baseline and compile its artifacts with -Yfuture-lazy-vals. Keep Scala 3.9 LTS and Scala Next as additional compile and test targets in CI. Resolve symbolic Scala version selectors in the build so exact versions remain centralized. --- .github/workflows/build-test.yml | 5 +++-- project/Common.scala | 11 +++++++++-- project/Dependencies.scala | 20 ++++++++++++++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 2f4cebb..3b5f98f 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -38,8 +38,9 @@ jobs: uses: playframework/.github/.github/workflows/cmd.yml@v4 with: java: 21, 17 - scala: 2.12.x, 2.13.x, 3.x - cmd: sbt "++$MATRIX_SCALA ; test" + # Symbolic lanes resolve to exact versions in project/Dependencies.scala. + scala: 2.12.x, 2.13.x, 3.3.x, 3.9.x, 3.next + cmd: sbt -Dscala.version=$MATRIX_SCALA testFull finish: name: Finish diff --git a/project/Common.scala b/project/Common.scala index 87b4485..4f49f5a 100644 --- a/project/Common.scala +++ b/project/Common.scala @@ -39,8 +39,8 @@ object Common extends AutoPlugin { organizationHomepage := Some(uri("https://playframework.com/")), homepage := Some(uri(s"https://github.com/playframework/${repoName}")), licenses := Seq(License("Apache-2.0", uri("https://www.apache.org/licenses/LICENSE-2.0.html"))), - scalaVersion := Scala212, - crossScalaVersions := ScalaVersions, + scalaVersion := resolveScalaVersion(sys.props.getOrElse("scala.version", scala213Version)), + crossScalaVersions := publishedScalaVersions, scalacOptions ++= scalacParameters, javacOptions ++= javacParameters, developers += Developer( @@ -52,4 +52,11 @@ object Common extends AutoPlugin { description := "Cachecontrol - Minimal HTTP cache management library in Scala" ) + override def projectSettings = + Seq( + scalacOptions ++= { + if (scalaVersion.value.startsWith("3.3.")) Seq("-Yfuture-lazy-vals") else Seq.empty + } + ) + } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 8e09d86..ddac6c0 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -4,11 +4,23 @@ import sbt._ object Dependencies { - val Scala212 = "2.12.21" - val Scala213 = "2.13.18" - val Scala3 = "3.3.8" + val scala212Version = "2.12.21" + val scala213Version = "2.13.18" + val scala33LTSVersion = "3.3.8" + val scala39LTSVersion = "3.9.0" + val scala3NextVersion = "3.10.0-RC2" - val ScalaVersions = Seq(Scala212, Scala213, Scala3) + val publishedScalaVersions = Seq(scala212Version, scala213Version, scala33LTSVersion) + + private val scalaVersionAliases = Map( + "2.12.x" -> scala212Version, + "2.13.x" -> scala213Version, + "3.3.x" -> scala33LTSVersion, + "3.9.x" -> scala39LTSVersion, + "3.next" -> scala3NextVersion, + ) + + def resolveScalaVersion(version: String): String = scalaVersionAliases.getOrElse(version, version) def scalaTest = "org.scalatest" %% "scalatest" % "3.2.20" % Test