Skip to content

Commit

Permalink
fix(RE-5): add cross compilation
Browse files Browse the repository at this point in the history
* fix(RE-5): add cross compilation

* fix(RE-5): why did IJ leave this out :/

* fix(RE-5): fmt++
  • Loading branch information
polentino authored Mar 23, 2024
1 parent 247e810 commit d09a47b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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",
"polentino911@gmail.com",
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 d09a47b

Please sign in to comment.