Skip to content
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

Merged
merged 3 commits into from
Feb 10, 2022
Merged

Conversation

xuwei-k
Copy link
Contributor

@xuwei-k xuwei-k commented Jan 23, 2022

No description provided.

.nativeSettings(
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion,
addCompilerPlugin("org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full),
pomPostProcess := { node =>
Copy link
Contributor Author

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,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not % Test?

Copy link
Contributor Author

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)

Copy link
Contributor Author

@xuwei-k xuwei-k Jan 23, 2022

Choose a reason for hiding this comment

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

Copy link
Collaborator

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? 🤔

@joroKr21 joroKr21 merged commit 2137969 into milessabin:main Feb 10, 2022
joroKr21 added a commit to joroKr21/shapeless that referenced this pull request Feb 10, 2022
joroKr21 added a commit that referenced this pull request Feb 10, 2022
Merge pull request #1229 from xuwei-k/native-junit-test
@xuwei-k xuwei-k deleted the native-junit-test branch October 14, 2023 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants