From 8873f55162d880c870800d3fc091a6566d0763ca Mon Sep 17 00:00:00 2001 From: Diego Casella Date: Sat, 23 Mar 2024 17:46:34 +0100 Subject: [PATCH 1/3] fix(RE-5): add cross compilation --- README.md | 2 +- build.sbt | 33 +++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 54d66a9..8375e8b 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ in your `build.sbt` file, add the following lines (once it will be published :) ```scala 3 libraryDependencies ++= Seq( "io.github.polentino" % "redacted" % redactedVersion, - compilerPlugin("io.github.polentino" % "redacted-plugin" % redactedVersion) + compilerPlugin("io.github.polentino" % "redacted-plugin" % redactedVersion cross CrossVersion.full) ) ``` diff --git a/build.sbt b/build.sbt index f87e286..5c25e31 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,17 @@ -ThisBuild / version := "0.3.0" +ThisBuild / version := "0.3.1" ThisBuild / scalaVersion := "3.1.3" +// all LTS versions & latest minor ones +val supportedScalaVersions = List( + "3.1.3", + "3.2.2", + "3.3.0", + "3.3.1", + "3.3.3", + "3.4.0" +) + +ThisBuild / crossScalaVersions := supportedScalaVersions ThisBuild / publishMavenStyle := true ThisBuild / crossPaths := false ThisBuild / versionScheme := Some("early-semver") @@ -23,7 +34,7 @@ inThisBuild( "polentino", "Diego Casella", "polentino911@gmail.com", - url("https://be.linkedin.com/in/diegocasella") + url("https://linkedin.com/in/diegocasella") ) ) ) @@ -34,6 +45,7 @@ Global / onChangedBuildSource := ReloadOnSourceChanges lazy val root = (project in file(".")) .settings( name := "redacted-root", + crossScalaVersions := Nil, publish / skip := true ) .aggregate(redactedLibrary, redactedCompilerPlugin, redactedTests) @@ -44,19 +56,22 @@ val scalafixSettings = Seq( semanticdbVersion := scalafixSemanticdb.revision ) +val crossCompileSettings = scalafixSettings ++ Seq( + Test / skip := true, + crossTarget := target.value / s"scala-${scalaVersion.value}", // workaround for https://github.com/sbt/sbt/issues/5097 + crossVersion := CrossVersion.full, + crossScalaVersions := supportedScalaVersions, +) + lazy val redactedLibrary = (project in file("library")) .settings(name := "redacted") - .settings( - scalafixSettings, - Test / skip := true - ) + .settings(crossCompileSettings) lazy val redactedCompilerPlugin = (project in file("plugin")) .dependsOn(redactedLibrary) .settings(name := "redacted-plugin") - .settings(scalafixSettings) + .settings(crossCompileSettings) .settings( - Test / skip := true, assembly / assemblyJarName := { val assemblyJarFile = (Compile / Keys.`package`).value assemblyJarFile.getName @@ -82,5 +97,7 @@ lazy val redactedTests = (project in file("tests")) } ) +addCommandAlias("testAll", "; +test") +addCommandAlias("publishAll", "; +publish") addCommandAlias("fmt", "; scalafix; scalafmtAll; scalafmtSbt") addCommandAlias("fmtCheck", "; scalafmtCheckAll ; scalafmtSbtCheck") From 23ba325bd91f651ff3d89dd60ccb9254240477f0 Mon Sep 17 00:00:00 2001 From: Diego Casella Date: Sat, 23 Mar 2024 17:48:24 +0100 Subject: [PATCH 2/3] fix(RE-5): why did IJ leave this out :/ --- .github/workflows/scala.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 89f44d3..75cb2c0 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -26,7 +26,7 @@ jobs: distribution: 'temurin' cache: 'sbt' - name: Check formatting & Run Tests - run: sbt fmtCheck test + run: sbt fmtCheck testAll # Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository - name: Upload dependency graph uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91 \ No newline at end of file From 1afbadd38e4c011d675b2431725210e8ac97a7b1 Mon Sep 17 00:00:00 2001 From: Diego Casella Date: Sat, 23 Mar 2024 17:49:22 +0100 Subject: [PATCH 3/3] fix(RE-5): fmt++ --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5c25e31..7a17b2c 100644 --- a/build.sbt +++ b/build.sbt @@ -60,7 +60,7 @@ val crossCompileSettings = scalafixSettings ++ Seq( Test / skip := true, crossTarget := target.value / s"scala-${scalaVersion.value}", // workaround for https://github.com/sbt/sbt/issues/5097 crossVersion := CrossVersion.full, - crossScalaVersions := supportedScalaVersions, + crossScalaVersions := supportedScalaVersions ) lazy val redactedLibrary = (project in file("library"))