Skip to content

Commit d5f0818

Browse files
authored
Merge pull request #20 from sjrd/scalajs-support
Add support for Scala.js.
2 parents e837d77 + ac9b25b commit d5f0818

File tree

3 files changed

+56
-17
lines changed

3 files changed

+56
-17
lines changed

.travis.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,33 @@
44
# packages:
55
# - oracle-java8-installer
66
language: scala
7+
scala:
8+
- 2.11.12
9+
- 2.12.5
10+
- 2.13.0-pre-b11db01
711
jdk:
812
- oraclejdk8
13+
env:
14+
- SCALAJS_VERSION=
15+
- SCALAJS_VERSION=0.6.22
16+
- SCALAJS_VERSION=1.0.0-M3
17+
matrix:
18+
exclude:
19+
- scala: 2.13.0-pre-b11db01
20+
env: SCALAJS_VERSION=0.6.22
21+
- scala: 2.13.0-pre-b11db01
22+
env: SCALAJS_VERSION=1.0.0-M3
23+
include:
24+
- scala: 2.12.5
25+
env: TEST_SCALAFIX=true
926
before_script:
1027
- ./checkCLA.sh
1128
script:
12-
- sbt +test
13-
- cd scalafix && sbt input/compile output/compile tests/test
29+
- |
30+
if [[ $TEST_SCALAFIX == "true" ]]; then
31+
cd scalafix && sbt input/compile output/compile tests/test
32+
elif [[ $SCALAJS_VERSION == "" ]]; then
33+
sbt ++$TRAVIS_SCALA_VERSION scala-collection-compat/test
34+
else
35+
sbt ++$TRAVIS_SCALA_VERSION scala-collection-compatJS/test
36+
fi

build.sbt

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1-
organization := "org.scala-lang"
1+
import sbtcrossproject.{crossProject, CrossType}
22

3-
name := "scala-collection-compat"
3+
inThisBuild(Def.settings(
4+
organization := "org.scala-lang",
5+
version := "0.1-SNAPSHOT",
6+
resolvers += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/",
7+
crossScalaVersions := Seq("2.12.5", "2.13.0-pre-b11db01", "2.11.12"),
8+
scalaVersion := crossScalaVersions.value.head
9+
))
410

5-
version := "0.1-SNAPSHOT"
11+
lazy val `scala-collection-compat` = crossProject(JSPlatform, JVMPlatform)
12+
.withoutSuffixFor(JVMPlatform)
13+
.crossType(CrossType.Pure)
14+
.in(file("."))
15+
.settings(
16+
name := "scala-collection-compat",
17+
unmanagedSourceDirectories in Compile += {
18+
val sharedSourceDir = baseDirectory.value.getParentFile / "src/main"
19+
if (scalaVersion.value.startsWith("2.13.")) sharedSourceDir / "scala-2.13"
20+
else sharedSourceDir / "scala-2.11_2.12"
21+
}
22+
)
23+
.jvmSettings(
24+
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
25+
)
26+
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
627

7-
resolvers += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"
8-
9-
unmanagedSourceDirectories in Compile += (
10-
if(scalaVersion.value.startsWith("2.13.")) (sourceDirectory in Compile).value / "scala-2.13"
11-
else (sourceDirectory in Compile).value / "scala-2.11_2.12"
12-
)
13-
14-
crossScalaVersions := Seq("2.12.5", "2.13.0-pre-b11db01", "2.11.12")
15-
16-
scalaVersion := crossScalaVersions.value.head
17-
18-
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
28+
lazy val `scala-collection-compatJVM` = `scala-collection-compat`.jvm
29+
lazy val `scala-collection-compatJS` = `scala-collection-compat`.js

project/plugins.sbt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
val scalaJSVersion =
2+
Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.22")
3+
4+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
5+
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.4.0")

0 commit comments

Comments
 (0)