Skip to content

Commit

Permalink
Add Scala.js cross build
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Jul 27, 2019
1 parent 649e28e commit f200629
Show file tree
Hide file tree
Showing 36 changed files with 50 additions and 26 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ env:
# SONA_PASS
- secure: "ggXFZBlzV5ek/rBaE9lrEZlAIfUrv4XDJ4OrP8daMrJxmwkXtoSbcB3z4VgqqWKzAzW89CcU1IiojzDbe/het3xEX4qxdz5Wt05/E+WOgbek528kelwMxq12XRe6xaCVfG+y8OISPgq1q3vKoO/xYGVbK3D6hSD+cjojEXyPpjAfrVSUof06aNPFPQeLX9exgu9zrxkJJm01PbTh19vQk4Ojc++oEmpF7HLD1CF1m7AlW0U2Rba+syivpj9Ray3Z9vu0TnFL06r4TiwZruwcXTLrWUqumFI0r5mhaY6SNH7bqttu+3RPIOdkUGxIeGlkDi3xopt7r2aEkhOKvjRXapW0e/CWmUo1J+NnlIumxrldi4n0iiJGVEvY4Krx/HGZe0wCVTh4vDNOllTGdFmkkxN6WoaHALgj3QNM3XLjvvUu3VcT+QNtsVIvgUDesrtos8zCKczzdhL/d4BMiIg7SFfA33S3vx8BeczLBqddrx+yLSPzfheKrHW7g76EAEyN26vE2/2/GRlMOlG8Lmu8rXBfIPsK9T/ztfE1CxaTW5EsMSrxO2+O/bvAa6DY0R79KkHf7LDI+azzP2NwYx8anM9WlMTp4EbawI/KGZRilWYtJ3Q3y5EQERsrP71W35dKqiBFMPdspS+lTS9hGtso08n7cR2MwTbRjoXVRcWfJ/I="
matrix:
- ADOPTOPENJDK=8
- ADOPTOPENJDK=11
# The empty SCALAJS_VERSION will only compile for the JVM
- SCALAJS_VERSION= ADOPTOPENJDK=8
- SCALAJS_VERSION=0.6.28 ADOPTOPENJDK=8
- SCALAJS_VERSION=1.0.0-M8 ADOPTOPENJDK=8
- SCALAJS_VERSION= ADOPTOPENJDK=11

before_install:
# adding $HOME/.sdkman to cache would create an empty directory, which interferes with the initial installation
Expand Down
65 changes: 41 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
import sbtcrossproject.CrossPlugin.autoImport.{ crossProject, CrossType }
import ScalaModulePlugin._

scalaModuleSettings
scalaModuleSettingsJVM

name := "scala-collection-contrib"
version := "0.1.1-SNAPSHOT"

crossScalaVersions in ThisBuild := Seq("2.13.0")

scalacOptions ++= Seq("-opt-warnings", "-language:higherKinds", "-deprecation", "-feature", "-Xfatal-warnings")
scalacOptions in (Compile, doc) ++= Seq("-implicits", "-groups")

testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-s", "-a")
parallelExecution in Test := false // why?

mimaPreviousVersion := Some("0.1.0")

homepage := Some(url("https://github.com/scala/scala-collection-contrib"))
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0"))

libraryDependencies ++= Seq(
"junit" % "junit" % "4.12" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test,
"org.openjdk.jol" % "jol-core" % "0.9" % Test
)
lazy val root = project.in(file("."))
.aggregate(`scala-collection-contribJS`, `scala-collection-contribJVM`)
.settings(disablePublishing)

lazy val `scala-collection-contrib` = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform).in(file("."))
.settings(scalaModuleSettings: _*)
.jvmSettings(scalaModuleSettingsJVM)
.settings(
name := "scala-collection-contrib",
version := "0.1.1-SNAPSHOT",

crossScalaVersions in ThisBuild := Seq("2.13.0"),

scalacOptions ++= Seq("-opt-warnings", "-language:higherKinds", "-deprecation", "-feature", "-Xfatal-warnings"),
scalacOptions in (Compile, doc) ++= Seq("-implicits", "-groups"),

testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-s", "-a"),
parallelExecution in Test := false, // why?

mimaPreviousVersion := Some("0.1.0"),

homepage := Some(url("https://github.com/scala/scala-collection-contrib")),
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0")),

libraryDependencies ++= Seq(
"junit" % "junit" % "4.12" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test,
"org.openjdk.jol" % "jol-core" % "0.9" % Test
)
)
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
.jsSettings(
mimaPreviousVersion := None,
// Scala.js cannot run forked tests
fork in Test := false
)

lazy val `scala-collection-contribJVM` = `scala-collection-contrib`.jvm
lazy val `scala-collection-contribJS` = `scala-collection-contrib`.js
4 changes: 4 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings")

val scalajsVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28")

addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalajsVersion)
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")

0 comments on commit f200629

Please sign in to comment.