From 06e7c542e04e722cd842a30adb56094fe3170e79 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Sun, 23 Jan 2022 11:28:07 +0900 Subject: [PATCH 1/2] enable scala-native junit tests --- build.sbt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 594791941..015096dee 100644 --- a/build.sbt +++ b/build.sbt @@ -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( @@ -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_native0.4")) + NodeSeq.Empty + else + n + }).transform(node)(0) + }, + ) } lazy val commonJsSettings = Seq( @@ -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 @@ -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 From 2bdcce827eb0e459d3bf0bc700c74b224a93fe86 Mon Sep 17 00:00:00 2001 From: Georgi Krastev Date: Thu, 10 Feb 2022 11:17:59 +0100 Subject: [PATCH 2/2] Don't hardcode junit native runtime version --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 015096dee..06acf9d8d 100644 --- a/build.sbt +++ b/build.sbt @@ -129,7 +129,7 @@ def configureJUnit(crossProject: CrossProject) = { import scala.xml.transform._ new RuleTransformer(new RewriteRule{ override def transform(n: Node) = - if (n.label == "dependency" && (n \ "artifactId").text.startsWith("junit-runtime_native0.4")) + if (n.label == "dependency" && (n \ "artifactId").text.startsWith("junit-runtime_native")) NodeSeq.Empty else n