Skip to content

Cross build with Scala Native #282

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

Merged
merged 4 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
67 changes: 52 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ThisBuild / crossScalaVersions := Seq("2.13.15", "3.3.4")
val scalaVersions = Seq("2.13.15", "3.3.4")
ThisBuild / crossScalaVersions := scalaVersions
ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.head

Global / concurrentRestrictions += Tags.limit(NativeTags.Link, 1)
Global / cancelable := true
publish / skip := true // in root

Expand All @@ -18,43 +20,78 @@ lazy val commonSettings: Seq[Setting[_]] =
}),
)

lazy val core = project.in(file("core"))
lazy val testNativeSettings: Seq[Setting[_]] = Seq(
// Required by Scala Native testing infrastructure
Test / fork := false,
)

lazy val core = projectMatrix.in(file("core"))
.settings(commonSettings)
.settings(
name := "scala-parallel-collections",
Compile / doc / autoAPIMappings := true,
)
.jvmPlatform(scalaVersions)
.nativePlatform(scalaVersions, settings = testNativeSettings ++ Seq(
versionPolicyPreviousArtifacts := Nil, // TODO: not yet published ,
mimaPreviousArtifacts := Set.empty
))

lazy val junit = project.in(file("junit"))
lazy val junit = projectMatrix.in(file("junit"))
.settings(commonSettings)
.settings(
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test,
libraryDependencies += "junit" % "junit" % "4.13.2" % Test,
// for javax.xml.bind.DatatypeConverter, used in SerializationStabilityTest
libraryDependencies += "javax.xml.bind" % "jaxb-api" % "2.3.1" % Test,
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
Test / fork := true,
publish / skip := true,
).dependsOn(testmacros, core)
.jvmPlatform(scalaVersions,
settings = Seq(
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test,
libraryDependencies += "junit" % "junit" % "4.13.2" % Test,
// for javax.xml.bind.DatatypeConverter, used in SerializationStabilityTest
libraryDependencies += "javax.xml.bind" % "jaxb-api" % "2.3.1" % Test,
Test / fork := true,
)
)
.nativePlatform(scalaVersions = scalaVersions,
axisValues = Nil,
configure = _
.enablePlugins(ScalaNativeJUnitPlugin)
.settings(
Test/unmanagedSources/excludeFilter ~= { _ ||
"SerializationTest.scala" || // requires ObjectOutputStream
"SerializationStability.scala" || // requires jaxb-api
"SerializationStabilityBase.scala" ||
"SerializationStabilityTest.scala"
},
Test / fork := false
)
)

lazy val scalacheck = project.in(file("scalacheck"))
lazy val scalacheck = projectMatrix.in(file("scalacheck"))
.settings(commonSettings)
.settings(
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.18.1",
Test / fork := true,
libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.18.1",
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-workers", "1", "-minSize", "0", "-maxSize", "4000", "-minSuccessfulTests", "5"),
publish / skip := true
).dependsOn(core)
.jvmPlatform(scalaVersions,
settings = Seq(
Test / fork := true
)
)
.nativePlatform(scalaVersions, settings = testNativeSettings)

lazy val testmacros = project.in(file("testmacros"))
lazy val testmacros = projectMatrix.in(file("testmacros"))
.settings(commonSettings)
.settings(
libraryDependencies += (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => scalaOrganization.value %% "scala3-compiler" % scalaVersion.value
case _ => scalaOrganization.value % "scala-compiler" % scalaVersion.value
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Nil
case _ => List(scalaOrganization.value % "scala-compiler" % scalaVersion.value)
}),
publish / skip := true,
)
.jvmPlatform(scalaVersions)
.nativePlatform(scalaVersions, settings = testNativeSettings)

commands += Command.single("setScalaVersion") { (state, arg) =>
val command = arg match {
Expand Down
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.2.0")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.6")
Loading