Skip to content

Commit

Permalink
fix(RE-5): add cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
polentino committed Mar 23, 2024
1 parent 247e810 commit 8873f55
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
```

Expand Down
33 changes: 25 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -23,7 +34,7 @@ inThisBuild(
"polentino",
"Diego Casella",
"[email protected]",
url("https://be.linkedin.com/in/diegocasella")
url("https://linkedin.com/in/diegocasella")
)
)
)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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")

0 comments on commit 8873f55

Please sign in to comment.