From 1b9ffb8e232a5baeb64b472fcd2c1d5180f4d193 Mon Sep 17 00:00:00 2001 From: Jamie Willis Date: Mon, 24 Oct 2022 20:10:16 +0100 Subject: [PATCH 1/3] Added scala-native support, but seems to require a flag to be commented out? --- build.sbt | 15 ++++++++++----- project/plugins.sbt | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index a765447..3ae520d 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ ThisBuild / scalaVersion := "3.1.3" ThisBuild / crossScalaVersions := Seq((ThisBuild / scalaVersion).value, "2.13.8") lazy val root = project.in(file(".")) - .aggregate(collectionContrib.jvm, collectionContrib.js) + .aggregate(collectionContrib.jvm, collectionContrib.js, collectionContrib.native) .settings( publish / skip := true, // With CrossType.Pure, the root project also picks up the sources in `src` @@ -10,7 +10,7 @@ lazy val root = project.in(file(".")) Test / unmanagedSourceDirectories := Nil, ) -lazy val collectionContrib = crossProject(JVMPlatform, JSPlatform) +lazy val collectionContrib = crossProject(JVMPlatform, JSPlatform, NativePlatform) .crossType(CrossType.Pure) .in(file(".")) .settings(ScalaModulePlugin.scalaModuleSettings) @@ -21,7 +21,7 @@ lazy val collectionContrib = crossProject(JVMPlatform, JSPlatform) Compile / compile / scalacOptions ++= { CrossVersion.partialVersion(scalaVersion.value) match { case Some((2, _)) => Seq("-opt-warnings", "-Werror", "-Wconf:origin=scala.collection.IterableOps.toIterable:s") - case _ => Seq("-Xfatal-warnings", "-scala-output-version:3.0", "-Wconf:cat=deprecation:s") + case _ => Seq("-Xfatal-warnings", /*"-scala-output-version:3.0",*/ "-Wconf:cat=deprecation:s") } }, Compile / doc / scalacOptions ++= { @@ -42,6 +42,11 @@ lazy val collectionContrib = crossProject(JVMPlatform, JSPlatform) // Scala.js cannot run forked tests Test / fork := false ) + .nativeEnablePlugins(ScalaNativeJUnitPlugin) + .nativeSettings( + Test / fork := false // is this needed? + ) -lazy val collectionContribJVM = collectionContrib.jvm -lazy val collectionContribJS = collectionContrib.js +lazy val collectionContribJVM = collectionContrib.jvm +lazy val collectionContribJS = collectionContrib.js +lazy val collectionContribNative = collectionContrib.native diff --git a/project/plugins.sbt b/project/plugins.sbt index b584662..3d79310 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,5 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") From eb84965a52df719c7fa7f92fcf5c5c7caa0bf36a Mon Sep 17 00:00:00 2001 From: Jamie Willis Date: Tue, 25 Oct 2022 08:06:32 +0100 Subject: [PATCH 2/3] Removed unneeded flag, trying forked tests on native --- build.sbt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 3ae520d..ff6f5b3 100644 --- a/build.sbt +++ b/build.sbt @@ -21,7 +21,7 @@ lazy val collectionContrib = crossProject(JVMPlatform, JSPlatform, NativePlatfor Compile / compile / scalacOptions ++= { CrossVersion.partialVersion(scalaVersion.value) match { case Some((2, _)) => Seq("-opt-warnings", "-Werror", "-Wconf:origin=scala.collection.IterableOps.toIterable:s") - case _ => Seq("-Xfatal-warnings", /*"-scala-output-version:3.0",*/ "-Wconf:cat=deprecation:s") + case _ => Seq("-Xfatal-warnings", "-Wconf:cat=deprecation:s") } }, Compile / doc / scalacOptions ++= { @@ -43,9 +43,6 @@ lazy val collectionContrib = crossProject(JVMPlatform, JSPlatform, NativePlatfor Test / fork := false ) .nativeEnablePlugins(ScalaNativeJUnitPlugin) - .nativeSettings( - Test / fork := false // is this needed? - ) lazy val collectionContribJVM = collectionContrib.jvm lazy val collectionContribJS = collectionContrib.js From d9030155df1875ebda3b2d210b5235d27b72c6ed Mon Sep 17 00:00:00 2001 From: Jamie Willis Date: Tue, 25 Oct 2022 08:39:32 +0100 Subject: [PATCH 3/3] Disabled test fork for native --- build.sbt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.sbt b/build.sbt index ff6f5b3..07150cd 100644 --- a/build.sbt +++ b/build.sbt @@ -43,6 +43,10 @@ lazy val collectionContrib = crossProject(JVMPlatform, JSPlatform, NativePlatfor Test / fork := false ) .nativeEnablePlugins(ScalaNativeJUnitPlugin) + .nativeSettings( + // Scala native cannot run forked tests + Test / fork := false + ) lazy val collectionContribJVM = collectionContrib.jvm lazy val collectionContribJS = collectionContrib.js