Skip to content

Commit

Permalink
Merge pull request #35 from exoego/scalajs
Browse files Browse the repository at this point in the history
Add Scala.js cross build
  • Loading branch information
SethTisue committed Jul 29, 2019
2 parents c228c96 + 68b9918 commit 1988581
Show file tree
Hide file tree
Showing 3 changed files with 55 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
70 changes: 46 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
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,
// HACK If we don’t add this dependency the tests compilation of the aggregated projects fails
libraryDependencies += "junit" % "junit" % "4.12" % Test
)

lazy val `scala-collection-contrib` = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.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 1988581

Please sign in to comment.