Skip to content

Commit

Permalink
Add support for Scala Native 0.5.x.
Browse files Browse the repository at this point in the history
Unfortunately, there is no patch Scala version in common between
Scala.js 0.6.x and Scala Native 0.5.x. This means we have to force
different versions when building for Native 0.5.x.
  • Loading branch information
sjrd committed May 31, 2024
1 parent 8a4a7b3 commit 663dc0f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ jobs:
matrix:
scalaversion: ["2.11.12", "2.12.13", "2.13.4"]
platform: ["JVM", "JS", "JS-0.6.x", "Native"]
include:
# Earliest Scala versions supported by Scala Native 0.5.x
- platform: "Native-0.5.x"
scalaversion: "2.12.14"
- platform: "Native-0.5.x"
scalaversion: "2.13.8"
env:
SCALAJS_VERSION: "${{ matrix.platform == 'JS-0.6.x' && '0.6.33' || '' }}"
PROJECT_NAME: "portable-scala-reflect${{ matrix.platform == 'JS-0.6.x' && 'JS' || matrix.platform }}"
SCALANATIVE_VERSION: "${{ matrix.platform == 'Native-0.5.x' && '0.5.2' || '' }}"
PROJECT_NAME: "portable-scala-reflect${{ matrix.platform == 'JS-0.6.x' && 'JS' || matrix.platform == 'Native-0.5.x' && 'Native' || matrix.platform }}"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v4
Expand All @@ -27,8 +34,8 @@ jobs:
java-version: "[email protected]"
- uses: coursier/cache-action@v5
- name: Unit tests
run: sbt "++${{ matrix.scalaversion }}" "${{ env.PROJECT_NAME }}/test"
run: sbt "++${{ matrix.scalaversion }}!" "${{ env.PROJECT_NAME }}/test"
- name: Test generate documentation
run: sbt "++${{ matrix.scalaversion }}" "${{ env.PROJECT_NAME }}/doc"
run: sbt "++${{ matrix.scalaversion }}!" "${{ env.PROJECT_NAME }}/doc"
- name: MiMa
run: sbt "++${{ matrix.scalaversion }}" "${{ env.PROJECT_NAME }}/mimaReportBinaryIssues"
run: sbt "++${{ matrix.scalaversion }}!" "${{ env.PROJECT_NAME }}/mimaReportBinaryIssues"
10 changes: 8 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ lazy val `portable-scala-reflect` = crossProject(JSPlatform, JVMPlatform, Native
.settings(
scalacOptions in (Compile, doc) -= "-Xfatal-warnings",

mimaPreviousArtifacts +=
organization.value %%% moduleName.value % previousVersion,
mimaPreviousArtifacts ++= {
val isNewInThisRelease = System.getenv("SCALANATIVE_VERSION") == "0.5.2"
if (isNewInThisRelease)
Set.empty
else
Set(organization.value %%% moduleName.value % previousVersion)
},
mimaFailOnNoPrevious := false,

publishMavenStyle := true,
publishTo := {
Expand Down
5 changes: 4 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).filter(_ != "").getOrElse("1.0.0")

val scalaNativeVersion =
Option(System.getenv("SCALANATIVE_VERSION")).filter(_ != "").getOrElse("0.4.4")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")

addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion)
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")

0 comments on commit 663dc0f

Please sign in to comment.