Skip to content

Instantly share code, notes, and snippets.

@odd
Last active January 4, 2018 14:41
Show Gist options
  • Save odd/5d909c2fc0da3ac63a5f1464c333062a to your computer and use it in GitHub Desktop.
Save odd/5d909c2fc0da3ac63a5f1464c333062a to your computer and use it in GitHub Desktop.
Patch to disable cross compile for scala/collection-strawman (to make the project work in IDEA)
diff --git a/build.sbt b/build.sbt
index effe9..e3f84 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,5 +1,5 @@
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
-import org.scalajs.sbtplugin.cross.CrossProject
+//import org.scalajs.sbtplugin.cross.CrossProject
// Convenient setting that allows writing `set scalaVersion := dotty.value` in sbt shell to switch from Scala to Dotty
val dotty = settingKey[String]("dotty version")
@@ -57,6 +57,7 @@ val disableDotty = Seq(
crossScalaVersions ~= (_.filterNot(_.startsWith("0.")))
)
+/*
def crossProj(id: String, base: File) =
CrossProject(id, base, CrossType.Pure)
.settings(commonSettings)
@@ -70,7 +71,6 @@ def crossProj(id: String, base: File) =
)
)
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
-
val collections =
crossProj("collections", file("collections"))
.settings(
@@ -80,7 +80,19 @@ val collections =
val collectionsJVM = collections.jvm
val collectionsJS = collections.js
+*/
+
+val collections = project.in(file("collections"))
+ .settings(commonSettings)
+ .settings(
+ name := "collection-strawman",
+ scalacOptions += "-Yno-imports",
+ libraryDependencies ++= Seq(
+ "com.novocode" % "junit-interface" % "0.11" % Test
+ )
+ )
+/*
val `collections-contrib` =
crossProj("collections-contrib", file("collections-contrib"))
.dependsOn(collections)
@@ -90,7 +102,15 @@ val `collections-contrib` =
val `collections-contrib-jvm` = `collections-contrib`.jvm
val `collections-contrib-js` = `collections-contrib`.js
+*/
+val `collections-contrib` = project.in(file("collections-contrib"))
+ .dependsOn(collections)
+ .settings(commonSettings)
+ .settings(
+ name := "collection-contrib"
+ )
+/*
val `collection-strawman` = project.in(file("."))
.settings(commonSettings ++ disablePublishing)
.settings(
@@ -107,9 +127,25 @@ val `collection-strawman` = project.in(file("."))
}
}
)
-
+*/
+val `collection-strawman` = project.in(file("."))
+ .settings(commonSettings ++ disablePublishing)
+ .settings(
+ // Some short-cuts for common tasks
+ test in Test := (test in (collections, Test)).value,
+ compile in Compile := (compile in (collections, Compile)).value,
+ compile in Test := (compile in (collections, Test)).value,
+ Seq(publish, publishLocal, publishSigned).map { publishKey =>
+ publishKey := {
+ val a = (publishKey in collections).value //val a = (publishKey in collectionsJVM).value
+ //val b = (publishKey in collectionsJS).value
+ val c = (publishKey in `collections-contrib`).value // val c = (publishKey in `collections-contrib-jvm`).value
+ //val d = (publishKey in `collections-contrib-js`).value
+ }
+ }
+ )
val junit = project.in(file("test") / "junit")
- .dependsOn(collectionsJVM)
+ .dependsOn(collections) //.dependsOn(collectionsJVM)
.settings(commonSettings ++ disablePublishing)
.settings(
fork in Test := true,
@@ -123,7 +159,7 @@ val junit = project.in(file("test") / "junit")
)
val scalacheck = project.in(file("test") / "scalacheck")
- .dependsOn(collectionsJVM)
+ .dependsOn(collections) //.dependsOn(collectionsJVM)
.settings(commonSettings)
.settings(disablePublishing)
// Dotty 0.3.0-RC1 crashes when trying to compile this project
@@ -138,7 +174,7 @@ val scalacheck = project.in(file("test") / "scalacheck")
val timeBenchmark =
project.in(file("benchmarks/time"))
- .dependsOn(collectionsJVM)
+ .dependsOn(collections) //.dependsOn(collectionsJVM)
.enablePlugins(JmhPlugin)
.settings(commonSettings ++ disablePublishing)
// Dotty 0.3.0-RC1 crashes when trying to compile this project
@@ -159,10 +195,10 @@ val timeBenchmark =
val memoryBenchmark =
project.in(file("benchmarks/memory"))
- .dependsOn(collectionsJVM)
+ .dependsOn(collections) //.dependsOn(collectionsJVM)
.settings(commonSettings ++ disablePublishing)
.settings(
- libraryDependencies += ("org.spire-math" %% "jawn-ast" % "0.10.4").withDottyCompat(),
+ libraryDependencies += ("org.spire-math" %% "jawn-ast" % "0.11.1-SNAPSHOT").withDottyCompat(),
charts := Def.inputTaskDyn {
val targetDir = crossTarget.value
val report = targetDir / "report.json"
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 4d1c6..5163f 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -6,7 +6,7 @@ addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.20")
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.1.7")
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.20")
+//addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.20")
// for bencharts
libraryDependencies ++= Seq(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment