Skip to content

Commit

Permalink
Close #283 - Add support for Scala Native
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-lee committed Sep 26, 2024
1 parent d1cb2eb commit 8ccd808
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
scala:
- { name: "Scala 2", version: "2.12.13", binary-version: "2.12", java-version: "[email protected]" }
- { name: "Scala 2", version: "2.12.19", binary-version: "2.12", java-version: "[email protected]" }
- { name: "Scala 2", version: "2.13.10", binary-version: "2.13", java-version: "[email protected]" }
- { name: "Scala 3", version: "3.1.3", binary-version: "3", java-version: "[email protected]" }

Expand Down
34 changes: 23 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ lazy val hedgehog = Project(
.settings(standardSettings)
.settings(noPublish)
.aggregate(
coreJVM, coreJS,
runnerJVM, runnerJS,
sbtTestJVM, sbtTestJS,
testJVM, testJS,
coreJVM, coreJS, coreNative,
runnerJVM, runnerJS, runnerNative,
sbtTestJVM, sbtTestJS, sbtTestNative,
testJVM, testJS, testNative,
exampleJVM, exampleJS,
minitestJVM, minitestJS,
munitJVM, munitJS
munitJVM, munitJS,
)

lazy val core = crossProject(JVMPlatform, JSPlatform)
lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.in(file("core"))
.settings(
standardSettings ++ Seq(
Expand All @@ -39,6 +39,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform)
)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val coreNative = core.native.settings(nativeSettings)

lazy val example = crossProject(JVMPlatform, JSPlatform)
.in(file("example"))
Expand All @@ -51,7 +52,7 @@ lazy val example = crossProject(JVMPlatform, JSPlatform)
lazy val exampleJVM = example.jvm
lazy val exampleJS = example.js

lazy val runner = crossProject(JVMPlatform, JSPlatform)
lazy val runner = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.in(file("runner"))
.settings(
standardSettings ++ Seq(
Expand All @@ -66,8 +67,9 @@ lazy val runner = crossProject(JVMPlatform, JSPlatform)
.dependsOn(core)
lazy val runnerJVM = runner.jvm
lazy val runnerJS = runner.js
lazy val runnerNative = runner.native.settings(nativeSettings)

lazy val sbtTest = crossProject(JVMPlatform, JSPlatform)
lazy val sbtTest = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.in(file("sbt-test"))
.settings(
standardSettings ++ Seq(
Expand All @@ -86,9 +88,14 @@ lazy val sbtTest = crossProject(JVMPlatform, JSPlatform)
("org.scala-js" %% "scalajs-test-interface" % "1.10.0")
.cross(CrossVersion.for3Use2_13),
)
.nativeSettings(
libraryDependencies +=
"org.scala-sbt" % "test-interface" % "1.0",
)
.dependsOn(core, runner)
lazy val sbtTestJVM = sbtTest.jvm
lazy val sbtTestJS = sbtTest.js
lazy val sbtTestNative = sbtTest.native.settings(nativeSettings)

lazy val minitest = crossProject(JVMPlatform, JSPlatform)
.in(file("minitest"))
Expand Down Expand Up @@ -136,7 +143,7 @@ lazy val munit = crossProject(JVMPlatform, JSPlatform)
lazy val munitJVM = munit.jvm
lazy val munitJS = munit.js

lazy val test = crossProject(JVMPlatform, JSPlatform)
lazy val test = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.settings(
standardSettings ++ noPublish ++ Seq(
name := "hedgehog-test",
Expand All @@ -145,6 +152,7 @@ lazy val test = crossProject(JVMPlatform, JSPlatform)
.dependsOn(core, runner, sbtTest)
lazy val testJVM = test.jvm
lazy val testJS = test.js
lazy val testNative = test.native.settings(nativeSettings)

lazy val docs = (project in file("generated-docs"))
.enablePlugins(MdocPlugin, DocusaurPlugin, ScalaUnidocPlugin)
Expand Down Expand Up @@ -250,9 +258,9 @@ lazy val compilationSettings = Seq(

lazy val props = new {
val ProjectScalaVersion = "2.13.10"
val CrossScalaVersions = Seq("2.12.13", ProjectScalaVersion, "3.1.3")
val CrossScalaVersions = Seq("2.12.19", ProjectScalaVersion, "3.1.3")

val PortableScalaReflectVersion = "1.1.1"
val PortableScalaReflectVersion = "1.1.3"

val MinitestVersion_2_11 = "2.8.2"
val MinitestVersion = "2.9.6"
Expand All @@ -272,6 +280,10 @@ lazy val standardSettings: Seq[Setting[_]] = Seq(
compilationSettings,
).flatten

lazy val nativeSettings: SettingsDefinition = List(
Test / fork := false
)

lazy val noPublish = Seq(
publish := {},
publishLocal := {},
Expand Down
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1")

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

addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.4")
addSbtPlugin("io.kevinlee" % "sbt-docusaur" % "0.16.0")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")

0 comments on commit 8ccd808

Please sign in to comment.