Skip to content

Commit 4dff899

Browse files
committed
Move JUnit Plugin to the test scope
1 parent 047e953 commit 4dff899

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

build.sbt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,23 @@ lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform)
167167
scalaModuleMimaPreviousVersion := None, // No such release yet
168168
// Scala Native cannot run forked tests
169169
Test / fork := false,
170-
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion,
171-
addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full),
170+
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion % Test,
171+
Test / scalacOptions += {
172+
val log = streams.value.log
173+
val retrieveDir = baseDirectory.value / "scala-native-junit-plugin-jars"
174+
val lm = dependencyResolution.value
175+
val cp = lm
176+
.retrieve(
177+
"org.scala-native" % s"junit-plugin_${scalaVersion.value}" % nativeVersion,
178+
scalaModuleInfo = None,
179+
retrieveDir,
180+
log
181+
)
182+
.fold(w => throw w.resolveException, identity(_))
183+
val jarPath = cp
184+
.find(_.toString.contains(s"/org/scala-native/junit-plugin_${scalaVersion.value}/$nativeVersion/junit-plugin_${scalaVersion.value}-$nativeVersion.jar"))
185+
.getOrElse(throw new Exception("Can't find Scala Native junit-plugin jar"))
186+
s"-Xplugin:$jarPath"
187+
},
172188
Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v")
173189
)

0 commit comments

Comments
 (0)