Skip to content

Commit 6fdec79

Browse files
authored
Merge pull request #182 from jatcwang/scala_native
Add scala native 0.5 support
2 parents 02e7fdd + 68b7c57 commit 6fdec79

5 files changed

Lines changed: 39 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ jobs:
2323
strategy:
2424
matrix:
2525
os: [ubuntu-latest]
26-
scala: [2_13, 3_0]
26+
scala: [all]
2727
java: [temurin@11]
28-
scalaPlatform: [jvm]
2928
runs-on: ${{ matrix.os }}
3029
steps:
3130
- name: Checkout current branch (full)

build.sbt

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ val isScala3 = Def.setting {
1616
}
1717

1818
val mainScalaVersion = Build.Scala213
19-
val jvmScalaVersions = Seq(Build.Scala213, Build.Scala3)
20-
val jsScalaVersions = Seq(Build.Scala213, Build.Scala3)
19+
val scalaCrossVersions = Seq(Build.Scala213, Build.Scala3)
2120

2221
inThisBuild(
2322
List(
@@ -65,15 +64,16 @@ lazy val core = projectMatrix
6564
Seq(file)
6665
}.taskValue,
6766
)
68-
.jvmPlatform(jvmScalaVersions)
67+
.jvmPlatform(scalaCrossVersions)
6968
.jsPlatform(
70-
jsScalaVersions,
69+
scalaCrossVersions,
7170
settings = Seq(
7271
libraryDependencies ++= Seq(
73-
"org.scala-js" %%% "scalajs-dom" % "2.8.1", // We need dom.intl.NumberFormat
72+
"org.scala-js" %%% "scalajs-dom" % "2.8.1",
7473
),
7574
),
7675
)
76+
.nativePlatform(scalaCrossVersions)
7777

7878
lazy val munit = projectMatrix
7979
.in(file("modules/munit"))
@@ -85,8 +85,9 @@ lazy val munit = projectMatrix
8585
"org.scalameta" %%% "munit" % munitVersion,
8686
),
8787
)
88-
.jvmPlatform(jvmScalaVersions)
89-
.jsPlatform(jsScalaVersions)
88+
.jvmPlatform(scalaCrossVersions)
89+
.jsPlatform(scalaCrossVersions)
90+
.nativePlatform(scalaCrossVersions)
9091

9192
lazy val scalatest = projectMatrix
9293
.in(file("modules/scalatest"))
@@ -98,7 +99,9 @@ lazy val scalatest = projectMatrix
9899
"org.scalatest" %%% "scalatest-core" % scalatestVersion,
99100
),
100101
)
101-
.jvmPlatform(jvmScalaVersions)
102+
.jvmPlatform(scalaCrossVersions)
103+
.jsPlatform(scalaCrossVersions)
104+
.nativePlatform(scalaCrossVersions)
102105

103106
lazy val weaver = projectMatrix
104107
.in(file("modules/weaver"))
@@ -110,8 +113,9 @@ lazy val weaver = projectMatrix
110113
"org.typelevel" %%% "weaver-core" % weaverVersion,
111114
),
112115
)
113-
.jvmPlatform(jvmScalaVersions)
114-
.jsPlatform(jsScalaVersions)
116+
.jvmPlatform(scalaCrossVersions)
117+
.jsPlatform(scalaCrossVersions)
118+
.nativePlatform(scalaCrossVersions)
115119

116120
lazy val cats = projectMatrix
117121
.in(file("modules/cats"))
@@ -126,8 +130,9 @@ lazy val cats = projectMatrix
126130
"org.typelevel" %%% "cats-laws" % catsVersion,
127131
).map(_ % Test),
128132
)
129-
.jvmPlatform(jvmScalaVersions)
130-
.jsPlatform(jsScalaVersions)
133+
.jvmPlatform(scalaCrossVersions)
134+
.jsPlatform(scalaCrossVersions)
135+
.nativePlatform(scalaCrossVersions)
131136

132137
lazy val coretest = projectMatrix
133138
.in(file("modules/coretest"))
@@ -144,8 +149,9 @@ lazy val coretest = projectMatrix
144149
"org.scalameta" %%% "munit-scalacheck" % munitScalacheckVersion,
145150
).map(_ % Test),
146151
)
147-
.jvmPlatform(jvmScalaVersions)
148-
.jsPlatform(jsScalaVersions)
152+
.jvmPlatform(scalaCrossVersions)
153+
.jsPlatform(scalaCrossVersions)
154+
.nativePlatform(scalaCrossVersions)
149155

150156
lazy val docs: ProjectMatrix = projectMatrix
151157
.dependsOn(core, coretest, cats, munit, scalatest, weaver)
@@ -189,7 +195,7 @@ lazy val benchmarks = projectMatrix
189195
.enablePlugins(JmhPlugin)
190196
.settings(commonSettings)
191197
.settings(noPublishSettings)
192-
.jvmPlatform(jvmScalaVersions)
198+
.jvmPlatform(scalaCrossVersions)
193199

194200
lazy val commonSettings = Seq(
195201
versionScheme := Some("early-semver"),
@@ -241,9 +247,7 @@ ThisBuild / githubWorkflowPublish := Seq(
241247
),
242248
)
243249

244-
ThisBuild / githubWorkflowBuildMatrixAdditions += ("scalaPlatform", List("jvm"))
245-
246-
ThisBuild / githubWorkflowScalaVersions := Seq("2_13", "3_0")
250+
ThisBuild / githubWorkflowScalaVersions := Seq("all")
247251

248252
ThisBuild / githubWorkflowBuildSbtStepPreamble := Seq.empty
249253

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package difflicious
2+
3+
import difflicious.differ.NumericDiffer
4+
5+
trait DifferPlatform {
6+
implicit val doubleDiffer: NumericDiffer[Double] =
7+
NumericDiffer.make[Double](_.toString)
8+
9+
implicit val floatDiffer: NumericDiffer[Float] =
10+
NumericDiffer.make[Float](_.toString)
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package difflicious
2+
3+
trait DifferTimeInstancesPlatform {
4+
}

project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.29.0")
77
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.9.0") // override mdoc version from microsite
88
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.11.0")
99
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.21.0")
10+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.11")
1011
// addSbtPlugin("com.47deg" % "sbt-microsites" % "1.4.4")
1112

1213
// There are conflicts with scala-xml 1.0 vs 2.0 with microsites enabled

0 commit comments

Comments
 (0)