Skip to content

Add support for Scala.js. #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
41 changes: 26 additions & 15 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")