diff --git a/.travis.yml b/.travis.yml index b29ad36..a263e94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/build.sbt b/build.sbt index a7c6449..4a5c909 100644 --- a/build.sbt +++ b/build.sbt @@ -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 diff --git a/project/plugins.sbt b/project/plugins.sbt index 2c32f62..0459ceb 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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")