From 951898dc03530577adf542982bd9fcd9af862fec Mon Sep 17 00:00:00 2001 From: pierscin <30854591+pierscin@users.noreply.github.com> Date: Thu, 24 Sep 2026 13:27:18 +0200 Subject: [PATCH] Migrate to sbt 2.0.9 and sbt-softwaremill 3.0.1 - sbt 2.0.9, sbt-softwaremill 3.0.1 - removed sbt-projectmatrix (built into sbt 2) - dropped Scala 2.11 - sbt-scalajs 1.21.0 -> 1.22.0 (sbt 2 compatible), sbt-ide-settings 1.1.2 -> 1.1.4 - common settings are now bare settings in build.sbt (applied to all subprojects in sbt 2) - updateDocs override moved to root - root moduleName set to quicklens-root, as in sbt 2 its output directory would overlap with the Scala 3 quicklens module - sbt 2 syntax adjustments (%%% -> %%, `: _*` -> `*`, slash syntax) - put -release 8 explicitly in scalac options for Scala 2 on the JVM - CI: JDK 11 -> 17, setup-sbt v1.5.10, `testOnly *` instead of `test`, shut down the sbt server before ci-release - scalafmt: scala3 dialect for *.sbt files Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 10 +++++---- .scalafmt.conf | 5 ++++- README.md | 2 +- build.sbt | 44 +++++++++++++++++++++++----------------- project/build.properties | 2 +- project/plugins.sbt | 7 +++---- 6 files changed, 40 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4b911da..e0e5e401 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,12 +22,13 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '11' + java-version: '17' cache: 'sbt' + - uses: sbt/setup-sbt@ce95da69b39609ea153bad087708da5f37366897 # v1, specifically v1.5.10 - name: Compile run: sbt -v compile - name: Test - run: sbt -v test + run: sbt -v "testOnly *" publish: name: Publish release @@ -44,10 +45,11 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '11' + java-version: '17' cache: 'sbt' + - uses: sbt/setup-sbt@ce95da69b39609ea153bad087708da5f37366897 # v1, specifically v1.5.10 - name: Compile - run: sbt compile + run: sbt "compile ; shutdown" - name: Publish artifacts run: sbt ci-release env: diff --git a/.scalafmt.conf b/.scalafmt.conf index e3d837e9..d0886cc0 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -11,4 +11,7 @@ fileOverride { "glob:**/scala-2.13-/**" { runner.dialect = scala213 } -} \ No newline at end of file + "glob:**.sbt" { + runner.dialect = scala3 + } +} diff --git a/README.md b/README.md index 50ae3810..3caa5976 100644 --- a/README.md +++ b/README.md @@ -277,7 +277,7 @@ Available in Maven Central: val quicklens = "com.softwaremill.quicklens" %% "quicklens" % "1.9.15" ```` -Available for Scala 2.11, 2.12, 2.13, [3](https://dotty.epfl.ch), [Scala.js](http://www.scala-js.org) and [Scala Native](http://www.scala-native.org)! +Available for Scala 2.12, 2.13, [3](https://dotty.epfl.ch), [Scala.js](http://www.scala-js.org) and [Scala Native](http://www.scala-native.org)! ## Commercial Support diff --git a/build.sbt b/build.sbt index f4d6ed67..45056fb1 100644 --- a/build.sbt +++ b/build.sbt @@ -2,33 +2,37 @@ import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings import com.softwaremill.Publish.{updateDocs, ossPublishSettings} import com.softwaremill.UpdateVersionInDocs -val scala211 = "2.11.12" val scala212 = "2.12.21" val scala213 = "2.13.18" val scala3 = "3.3.8" val scalaIdeaVersion = scala3 // the version for which to import sources into intellij -excludeLintKeys in Global ++= Set(ideSkipProject) +Global / excludeLintKeys ++= Set(ideSkipProject) -val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq( - organization := "com.softwaremill.quicklens", - updateDocs := UpdateVersionInDocs(sLog.value, organization.value, version.value, List(file("README.md"))), - scalacOptions ++= Seq( - "-deprecation", - "-feature", - "-unchecked" - ), // useful for debugging macros: "-Ycheck:all", "-Xcheck-macros" - ideSkipProject := (scalaVersion.value != scalaIdeaVersion) -) +commonSmlBuildSettings +ossPublishSettings + +organization := "com.softwaremill.quicklens" +scalacOptions ++= Seq( + "-deprecation", + "-feature", + "-unchecked" +) // useful for debugging macros: "-Ycheck:all", "-Xcheck-macros" +ideSkipProject := (scalaVersion.value != scalaIdeaVersion) lazy val root = project .in(file(".")) - .settings(commonSettings) - .settings(publishArtifact := false) - .settings(scalaVersion := scalaIdeaVersion) - .aggregate(quicklens.projectRefs: _*) + .settings( + publishArtifact := false, + moduleName := "quicklens-root", + scalaVersion := scalaIdeaVersion, + updateDocs := Def.uncached( + UpdateVersionInDocs(sLog.value, organization.value, version.value, List(file("README.md"))) + ) + ) + .aggregate(quicklens.projectRefs*) val versionSpecificScalaSources = { Compile / unmanagedSourceDirectories := { @@ -63,7 +67,6 @@ def reflectLibrary(scalaVersion: String) = { } lazy val quicklens = (projectMatrix in file("quicklens")) - .settings(commonSettings) .settings( name := "quicklens", libraryDependencies ++= reflectLibrary(scalaVersion.value), @@ -71,11 +74,14 @@ lazy val quicklens = (projectMatrix in file("quicklens")) libraryDependencies ++= compilerLibrary(scalaVersion.value), versionSpecificScalaSources, libraryDependencies ++= Seq("flatspec", "shouldmatchers").map(m => - "org.scalatest" %%% s"scalatest-$m" % "3.2.18" % Test + "org.scalatest" %% s"scalatest-$m" % "3.2.18" % Test ) ) .jvmPlatform( - scalaVersions = List(scala211, scala212, scala213, scala3) + scalaVersions = List(scala212, scala213, scala3), + settings = Seq( + scalacOptions ++= (if (ScalaArtifacts.isScala3(scalaVersion.value)) Seq.empty else Seq("-release", "8")) + ) ) .jsPlatform( scalaVersions = List(scala212, scala213, scala3) diff --git a/project/build.properties b/project/build.properties index 6d67d747..ddca111e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.12.12 \ No newline at end of file +sbt.version=2.0.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index 381dcb4c..61c9f980 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,11 +1,10 @@ -val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.21.0") +val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.22.0") val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).getOrElse("0.5.12") addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) -addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.11.0") -addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.2") +addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.4") -val sbtSoftwareMillVersion = "2.1.1" +val sbtSoftwareMillVersion = "3.0.1" addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion) addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)