-
Notifications
You must be signed in to change notification settings - Fork 531
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
enable scala-native junit tests #1229
Conversation
.nativeSettings( | ||
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion, | ||
addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full), | ||
pomPostProcess := { node => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not % Test
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scala-native compiler plugin( "org.scala-native" % "junit-plugin"
) throw error in compile time if set % Test
.
[error] scala.reflect.internal.MissingRequirementError: object org.junit.Test in compiler mirror not found.
[error] scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:24)
[error] scala.reflect.internal.Mirrors$RootsBase.$anonfun$getModuleOrClass$6(Mirrors.scala:66)
[error] scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
[error] scala.reflect.internal.Mirrors$RootsBase.getRequiredClass(Mirrors.scala:56)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$JUnitAnnots$.<init>(ScalaNativeJUnitPlugin.scala:48)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$.JUnitAnnots$lzycompute$1(ScalaNativeJUnitPlugin.scala:47)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$.scala$scalanative$junit$plugin$ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$$JUnitAnnots(ScalaNativeJUnitPlugin.scala:47)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$ScalaNativeJUnitPluginTransformer.$anonfun$transform$1(ScalaNativeJUnitPlugin.scala:97)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$ScalaNativeJUnitPluginTransformer.$anonfun$transform$1$adapted(ScalaNativeJUnitPlugin.scala:96)
[error] scala.collection.IterableOnceOps.exists(IterableOnce.scala:591)
[error] scala.collection.IterableOnceOps.exists$(IterableOnce.scala:588)
[error] scala.collection.AbstractIterable.exists(Iterable.scala:926)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$ScalaNativeJUnitPluginTransformer.hasTests$1(ScalaNativeJUnitPlugin.scala:96)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$ScalaNativeJUnitPluginTransformer.scala$scalanative$junit$plugin$ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$ScalaNativeJUnitPluginTransformer$$isTest$1(ScalaNativeJUnitPlugin.scala:107)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$ScalaNativeJUnitPluginTransformer$$anonfun$1.applyOrElse(ScalaNativeJUnitPlugin.scala:111)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$ScalaNativeJUnitPluginTransformer$$anonfun$1.applyOrElse(ScalaNativeJUnitPlugin.scala:110)
[error] scala.collection.immutable.List.collect(List.scala:267)
[error] scala.scalanative.junit.plugin.ScalaNativeJUnitPlugin$ScalaNativeJUnitPluginComponent$ScalaNativeJUnitPluginTransformer.transform(ScalaNativeJUnitPlugin.scala:110)
[error] scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:183)
[error] scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:32)
[error] scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:459)
[error] scala.tools.nsc.Global$GlobalPhase.run(Global.scala:406)
[error] scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1524)
[error] scala.tools.nsc.Global$Run.compileUnits(Global.scala:1508)
[error] scala.tools.nsc.Global$Run.compileSources(Global.scala:1500)
[error] scala.tools.nsc.Global$Run.compileFiles(Global.scala:1613)
[error] xsbt.CachedCompiler0.run(CompilerBridge.scala:163)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and there is no easy way add Scala compiler plugin only for test sources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I noticed that it works in shapeless-3 - how is that possible? 🤔
enable scala-native junit tests
Merge pull request #1229 from xuwei-k/native-junit-test
No description provided.