Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(RE-5): add cross compilation #8

Merged
merged 3 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
"[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")
Loading