diff --git a/.travis.yml b/.travis.yml index 2dcac0f4..5524bce5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,33 @@ # packages: # - oracle-java8-installer language: scala +scala: + - 2.11.12 + - 2.12.5 + - 2.13.0-pre-b11db01 jdk: - oraclejdk8 +env: + - SCALAJS_VERSION= + - SCALAJS_VERSION=0.6.22 + - SCALAJS_VERSION=1.0.0-M3 +matrix: + exclude: + - scala: 2.13.0-pre-b11db01 + env: SCALAJS_VERSION=0.6.22 + - scala: 2.13.0-pre-b11db01 + env: SCALAJS_VERSION=1.0.0-M3 + include: + - scala: 2.12.5 + env: TEST_SCALAFIX=true before_script: - ./checkCLA.sh script: - - sbt +test - - cd scalafix && sbt input/compile output/compile tests/test + - | + if [[ $TEST_SCALAFIX == "true" ]]; then + cd scalafix && sbt input/compile output/compile tests/test + elif [[ $SCALAJS_VERSION == "" ]]; then + sbt ++$TRAVIS_SCALA_VERSION scala-collection-compat/test + else + sbt ++$TRAVIS_SCALA_VERSION scala-collection-compatJS/test + fi diff --git a/build.sbt b/build.sbt index a7e598cf..d08ec76b 100644 --- a/build.sbt +++ b/build.sbt @@ -1,18 +1,29 @@ -organization := "org.scala-lang" +import sbtcrossproject.{crossProject, CrossType} -name := "scala-collection-compat" +inThisBuild(Def.settings( + organization := "org.scala-lang", + version := "0.1-SNAPSHOT", + resolvers += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/", + crossScalaVersions := Seq("2.12.5", "2.13.0-pre-b11db01", "2.11.12"), + scalaVersion := crossScalaVersions.value.head +)) -version := "0.1-SNAPSHOT" +lazy val `scala-collection-compat` = crossProject(JSPlatform, JVMPlatform) + .withoutSuffixFor(JVMPlatform) + .crossType(CrossType.Pure) + .in(file(".")) + .settings( + name := "scala-collection-compat", + unmanagedSourceDirectories in Compile += { + val sharedSourceDir = baseDirectory.value.getParentFile / "src/main" + if (scalaVersion.value.startsWith("2.13.")) sharedSourceDir / "scala-2.13" + else sharedSourceDir / "scala-2.11_2.12" + } + ) + .jvmSettings( + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test" + ) + .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) -resolvers += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/" - -unmanagedSourceDirectories in Compile += ( - if(scalaVersion.value.startsWith("2.13.")) (sourceDirectory in Compile).value / "scala-2.13" - else (sourceDirectory in Compile).value / "scala-2.11_2.12" -) - -crossScalaVersions := Seq("2.12.5", "2.13.0-pre-b11db01", "2.11.12") - -scalaVersion := crossScalaVersions.value.head - -libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test" +lazy val `scala-collection-compatJVM` = `scala-collection-compat`.jvm +lazy val `scala-collection-compatJS` = `scala-collection-compat`.js diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 00000000..3c396380 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,5 @@ +val scalaJSVersion = + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.22") + +addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.4.0")