From 6c8ee32322aad0552de7fb39206418081f292c94 Mon Sep 17 00:00:00 2001 From: pierscin <30854591+pierscin@users.noreply.github.com> Date: Mon, 28 Sep 2026 14:59:24 +0200 Subject: [PATCH 1/2] Migrate to sbt 2.0.9 and sbt-softwaremill 3.0.1 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/main.yaml | 34 ++++++++++++++-------- .scalafmt.conf | 7 ++++- build.sbt | 56 +++++++++++++++++-------------------- project/build.properties | 2 +- project/plugins.sbt | 8 +++--- 5 files changed, 59 insertions(+), 48 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 771c8e61..e83abe2f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -9,15 +9,17 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - - uses: coursier/cache-action@v6 - - uses: olafurpg/setup-scala@v14 + - uses: actions/setup-java@v5 with: - java-version: adopt@1.11 + distribution: 'temurin' + java-version: 17 + cache: 'sbt' + - uses: sbt/setup-sbt@ce95da69b39609ea153bad087708da5f37366897 # v1, specifically v1.5.10 - name: Run tests with sbt - run: sbt test + run: sbt testFull - name: Compile docs with mdoc run: sbt compileDocumentation @@ -25,13 +27,17 @@ jobs: name: Publish release if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) needs: [build] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: coursier/cache-action@v6 - - uses: olafurpg/setup-scala@v14 + - uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: 17 + cache: 'sbt' + - uses: sbt/setup-sbt@ce95da69b39609ea153bad087708da5f37366897 # v1, specifically v1.5.10 - run: sbt ci-release env: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} @@ -43,7 +49,7 @@ jobs: name: Publish docker image if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) needs: [build] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Login to DockerHub uses: docker/login-action@v2.2.0 @@ -53,6 +59,10 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: coursier/cache-action@v6 - - uses: olafurpg/setup-scala@v14 - - run: sbt docker:publish + - uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: 17 + cache: 'sbt' + - uses: sbt/setup-sbt@ce95da69b39609ea153bad087708da5f37366897 # v1, specifically v1.5.10 + - run: sbt Docker/publish diff --git a/.scalafmt.conf b/.scalafmt.conf index 1bbb67ae..02b698ce 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,3 +1,8 @@ version = 3.8.3 maxColumn = 120 -runner.dialect = scala213 \ No newline at end of file +runner.dialect = scala213 +fileOverride { + "glob:**.sbt" { + runner.dialect = scala3 + } +} diff --git a/build.sbt b/build.sbt index c888ec9f..89c6df91 100644 --- a/build.sbt +++ b/build.sbt @@ -4,6 +4,8 @@ import com.softwaremill.Publish.updateDocs import com.softwaremill.UpdateVersionInDocs import sbt.Def +val compileDocumentation: TaskKey[Unit] = taskKey[Unit]("Compiles documentation throwing away its output") + val http4sVersion = "0.23.28" val circeVersion = "0.14.4" val circeYamlVersion = "0.14.2" @@ -41,28 +43,20 @@ lazy val dockerSettings = Seq( Docker / version := { version.value.replace("+", "_") } ) -lazy val commonSettings: Seq[Def.Setting[_]] = commonSmlBuildSettings ++ ossPublishSettings ++ Seq( - organization := "com.softwaremill.sttp.livestub", - scalaVersion := "2.13.15", - scalafmtOnCompile := false, - scmInfo := Some( - ScmInfo( - url("https://github.com/softwaremill/livestub"), - "git@github.com:softwaremill/livestub.git" - ) - ), - updateDocs := Def.taskDyn { - val files1 = - UpdateVersionInDocs(sLog.value, organization.value, version.value, List(file("docs-sources") / "README.md")) - Def.task { - (docs / mdoc).toTask("").value - files1 ++ Seq(file("generated-docs"), file("README.md")) - } - }.value +commonSmlBuildSettings +ossPublishSettings + +organization := "com.softwaremill.sttp.livestub" +scalaVersion := "2.13.18" +scalafmtOnCompile := false +scmInfo := Some( + ScmInfo( + url("https://github.com/softwaremill/livestub"), + "git@github.com:softwaremill/livestub.git" + ) ) lazy val app: Project = (project in file("app")) - .settings(commonSettings) .enablePlugins(DockerPlugin) .enablePlugins(JavaServerAppPackaging) .settings(dockerSettings) @@ -84,7 +78,6 @@ lazy val app: Project = (project in file("app")) .dependsOn(api, openapi) lazy val api: Project = (project in file("api")) - .settings(commonSettings) .settings( name := "livestub-api", libraryDependencies ++= Seq( @@ -95,7 +88,6 @@ lazy val api: Project = (project in file("api")) ) lazy val sdk: Project = (project in file("sdk")) - .settings(commonSettings) .settings( name := "livestub-sdk", libraryDependencies ++= Seq( @@ -109,14 +101,8 @@ lazy val sdk: Project = (project in file("sdk")) ) .dependsOn(api, app % Test) -val compileDocumentation: TaskKey[Unit] = taskKey[Unit]("Compiles documentation throwing away its output") -compileDocumentation := { - (docs / mdoc).toTask(" --out target/generated-doc").value -} - lazy val docs = project .in(file("generated-docs")) // important: it must not be docs/ - .settings(commonSettings) .enablePlugins(MdocPlugin) .settings( publishArtifact := false, @@ -133,7 +119,6 @@ lazy val docs = project lazy val openapi = project .in(file("openapi")) - .settings(commonSettings) .settings( name := "openapi", libraryDependencies ++= Seq( @@ -144,6 +129,17 @@ lazy val openapi = project ) lazy val rootProject = (project in file(".")) - .settings(commonSettings) - .settings(publishArtifact := false, name := "livestub") + .settings( + publishArtifact := false, + name := "livestub", + updateDocs := Def.uncached(Def.taskDyn { + val files1 = + UpdateVersionInDocs(sLog.value, organization.value, version.value, List(file("docs-sources") / "README.md")) + Def.task { + (docs / mdoc).toTask("").value + files1 ++ Seq(file("generated-docs"), file("README.md")) + } + }.value), + compileDocumentation := (docs / mdoc).toTask(" --out target/generated-doc").value + ) .aggregate(app, api, sdk, docs, openapi) diff --git a/project/build.properties b/project/build.properties index 2e6f30fe..ddca111e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.10.2 \ No newline at end of file +sbt.version=2.0.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index daf31495..35c6d80a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % "2.0.20") -addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % "2.0.20") -addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.4") -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.6.1") +addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % "3.0.1") +addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % "3.0.1") +addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.12.0") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.9.2") From 346c89bf9c8bb586bea938559f9a34d003b477d8 Mon Sep 17 00:00:00 2001 From: pierscin <30854591+pierscin@users.noreply.github.com> Date: Thu, 1 Oct 2026 14:27:55 +0200 Subject: [PATCH 2/2] use rootProject and autoAggregate Co-Authored-By: Claude Opus 5.5 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 89c6df91..ca64df81 100644 --- a/build.sbt +++ b/build.sbt @@ -128,7 +128,7 @@ lazy val openapi = project ) ++ jsonDependencies ) -lazy val rootProject = (project in file(".")) +lazy val root = rootProject .settings( publishArtifact := false, name := "livestub", @@ -142,4 +142,4 @@ lazy val rootProject = (project in file(".")) }.value), compileDocumentation := (docs / mdoc).toTask(" --out target/generated-doc").value ) - .aggregate(app, api, sdk, docs, openapi) + .autoAggregate