Skip to content

Commit

Permalink
Merge pull request #1229 from xuwei-k/native-junit-test
Browse files Browse the repository at this point in the history
enable scala-native junit tests
  • Loading branch information
joroKr21 authored Feb 10, 2022
2 parents 6b26c21 + 2bdcce8 commit 2137969
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ addCommandAlias("examples", ";project examplesJVM")
addCommandAlias("validate", ";root;validateJVM;validateJS;validateNative")
addCommandAlias("validateJVM", ";coreJVM/compile;coreJVM/mimaReportBinaryIssues;coreJVM/test;examplesJVM/compile;examplesJVM/test;coreJVM/doc")
addCommandAlias("validateJS", ";coreJS/compile;coreJS/mimaReportBinaryIssues;coreJS/test;examplesJS/compile;examplesJS/test;coreJS/doc")
addCommandAlias("validateNative", ";coreNative/compile;nativeTest/run;examplesNative/compile")
addCommandAlias("validateNative", ";coreNative/compile;coreNative/test;nativeTest/run;examplesNative/compile;examplesNative/test;coreNative/doc")
addCommandAlias("runAll", ";examplesJVM/runAll")

def scalacOptionsAll(pluginJar: File) = List(
Expand Down Expand Up @@ -121,6 +121,21 @@ def configureJUnit(crossProject: CrossProject) = {
libraryDependencies +=
"com.github.sbt" % "junit-interface" % "0.13.3" % "test"
)
.nativeSettings(
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion,
addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full),
pomPostProcess := { node =>
import scala.xml._
import scala.xml.transform._
new RuleTransformer(new RewriteRule{
override def transform(n: Node) =
if (n.label == "dependency" && (n \ "artifactId").text.startsWith("junit-runtime_native"))
NodeSeq.Empty
else
n
}).transform(node)(0)
},
)
}

lazy val commonJsSettings = Seq(
Expand Down Expand Up @@ -180,7 +195,6 @@ lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform).crossType(
Compile / packageDoc / publishArtifact := false,
packageDoc / publishArtifact := false,
Compile / doc / sources := Nil,
Test / sources := Nil
)

lazy val coreJVM = core.jvm
Expand Down Expand Up @@ -224,7 +238,6 @@ lazy val examples = crossProject(JSPlatform, JVMPlatform, NativePlatform).crossT
.jvmSettings(commonJvmSettings:_*)
.nativeSettings(
Compile / sources ~= (_.filterNot(_.getName == "sexp.scala")),
Test / sources := Nil
)

lazy val examplesJVM = examples.jvm
Expand Down

0 comments on commit 2137969

Please sign in to comment.