Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,6 @@ workflows:
- scalanative_job:
name: native0.4_2.13
scala_version: 2.13.8
- scalanative_job:
name: native0.4_3
scala_version: 3.1.0
76 changes: 58 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,66 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
)
.jsEnablePlugins(ScalaJSJUnitPlugin)
.nativeSettings(
crossScalaVersions := Seq("2.13.8", "2.12.15"),
crossScalaVersions := Seq("2.13.8", "2.12.15", "3.1.0"),
Copy link

@sideeffffect sideeffffect Jan 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've heard 3.1.1 fixes some issues with Scala Native on Scala 3.x

mimaPreviousArtifacts := {
// TODO remove this setting whien 2.0.2 released
if (scalaBinaryVersion.value == "3") {
mimaPreviousArtifacts.value.filterNot(_.revision == "2.0.1")
} else {
mimaPreviousArtifacts.value
}
},
// Scala Native cannot run forked tests
Test / fork := false,
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test,
Test / scalacOptions += {
val log = streams.value.log
val retrieveDir = baseDirectory.value / "scala-native-junit-plugin-jars"
val lm = dependencyResolution.value
val cp = lm
.retrieve(
"org.scala-native" % s"junit-plugin_${scalaVersion.value}" % nativeVersion,
scalaModuleInfo = None,
retrieveDir,
log
)
.fold(w => throw w.resolveException, identity(_))
val jarPath = cp
.find(_.toString.contains("junit-plugin"))
.getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar"))
s"-Xplugin:$jarPath"
Seq(Compile, Test).map { s =>
s / sources := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, 0)) =>
Nil
case _ =>
(s / sources).value
}
}
},
libraryDependencies := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, 0)) =>
// scala-native does not support Scala 3.0.x
Nil
case _ =>
libraryDependencies.value ++ Seq("org.scala-native" %%% "junit-runtime" % nativeVersion % Test)
}
},
Compile / doc / scalacOptions --= {
// TODO remove this workaround
// https://github.com/scala-native/scala-native/issues/2503
if (scalaBinaryVersion.value == "3") {
(Compile / doc / scalacOptions).value.filter(_.contains("-Xplugin"))
} else {
Nil
}
},
publish / skip := CrossVersion.partialVersion(scalaVersion.value) == Some((3, 0)),
Test / scalacOptions ++= {
if (CrossVersion.partialVersion(scalaVersion.value) != Some((3, 0))) {
val log = streams.value.log
val retrieveDir = baseDirectory.value / "scala-native-junit-plugin-jars"
val lm = dependencyResolution.value
val cp = lm
.retrieve(
"org.scala-native" % s"junit-plugin_${scalaVersion.value}" % nativeVersion,
scalaModuleInfo = None,
retrieveDir,
log
)
.fold(w => throw w.resolveException, identity(_))
val jarPath = cp
.find(_.toString.contains("junit-plugin"))
.getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar"))
Seq(s"-Xplugin:$jarPath")
} else {
Nil
}
},
Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v")
)