diff --git a/.travis.yml b/.travis.yml
index fff3df2..d0623d7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,15 +1,31 @@
language: scala
+sudo: required
+dist: trusty
script:
- - sbt ++$TRAVIS_SCALA_VERSION sourcecodeJVM/test:run sourcecodeJS/test:run
-scala:
- - 2.10.6
- - 2.11.8
- - 2.12.0
+ # plz is like ++ except it skips projects that are not defined for that scala version.
+ - sbt "plz $TRAVIS_SCALA_VERSION test"
jdk:
- - openjdk7
- oraclejdk8
+scala:
+ - 2.10.6
+ - 2.11.11
+ - 2.12.2
+ - 2.13.0-M1
matrix:
- exclude:
- - scala: 2.12.0
+ include:
+ - scala: 2.10.6
jdk: openjdk7
-sudo: false
+before_install:
+ - bash bin/travis_setup.sh
+cache:
+ directories:
+ - $HOME/.sbt/0.13/dependency
+ - $HOME/.sbt/boot/scala*
+ - $HOME/.sbt/launchers
+ - $HOME/.ivy2/cache
+ - $HOME/.nvm
+before_cache:
+ - du -h -d 1 $HOME/.ivy2/cache
+ - du -h -d 2 $HOME/.sbt/
+ - find $HOME/.sbt -name "*.lock" -type f -delete
+ - find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete
diff --git a/bin/travis_setup.sh b/bin/travis_setup.sh
new file mode 100755
index 0000000..9aeea8d
--- /dev/null
+++ b/bin/travis_setup.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+# Original script from https://github.com/scala-native/scala-native/blob/c4eac0707bebc08f4979a0d0eaed16427b734171/bin/travis_setup.sh
+
+# Enable strict mode and fail the script on non-zero exit code,
+# unresolved variable or pipe failure.
+set -euo pipefail
+IFS=$'\n\t'
+
+if [ "$(uname)" == "Darwin" ]; then
+
+ brew update
+ brew install sbt
+ brew install bdw-gc
+ brew link bdw-gc
+ brew install jq
+ brew install re2
+ brew install llvm@4
+ export PATH="/usr/local/opt/llvm@4/bin:$PATH"
+
+else
+
+ # Install LLVM/Clang, Boehm GC, libunwind
+ sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
+ sudo apt-get -qq update
+ sudo apt-get install -y -qq \
+ clang++-3.8 \
+ libgc-dev \
+ libunwind8-dev
+
+ # Install re2
+ # Starting from Ubuntu 16.04 LTS, it'll be available as http://packages.ubuntu.com/xenial/libre2-dev
+ sudo apt-get install -y make
+ export CXX=clang++-3.8
+ git clone https://code.googlesource.com/re2
+ pushd re2
+ git checkout 2017-03-01
+ make -j4 test
+ sudo make install prefix=/usr
+ make testinstall prefix=/usr
+ popd
+
+fi
diff --git a/build.sbt b/build.sbt
index 0d7b644..853afe5 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,6 +1,38 @@
+import sbtcrossproject.{crossProject, CrossType}
import OsgiKeys._
-crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0")
+val scala210 = "2.10.6"
+val scala211 = "2.11.11"
+val scala212 = "2.12.2"
+val scala213 = "2.13.0-M1"
+val baseSettings = Seq(
+ organization := "com.lihaoyi",
+ name := "sourcecode",
+ version := "0.1.4",
+ scalaVersion := scala211,
+ crossScalaVersions := Seq(scala210, scala211, scala212, scala213),
+ scmInfo := Some(ScmInfo(
+ browseUrl = url("https://github.com/lihaoyi/sourcecode"),
+ connection = "scm:git:git@github.com:lihaoyi/sourcecode.git"
+ )),
+ homepage := Some(url("https://github.com/lihaoyi/sourcecode")),
+ licenses := Seq("MIT" -> url("http://www.opensource.org/licenses/mit-license.html")),
+ developers += Developer(
+ email = "haoyi.sg@gmail.com",
+ id = "lihaoyi",
+ name = "Li Haoyi",
+ url = url("https://github.com/lihaoyi")
+ ),
+ publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
+)
+lazy val noPublish = Seq(
+ publishArtifact := false,
+ publish := {},
+ publishLocal := {}
+)
+
+baseSettings
+noPublish
def macroDependencies(version: String) =
Seq(
@@ -13,46 +45,33 @@ def macroDependencies(version: String) =
else
Seq())
-lazy val sourcecode = crossProject.settings(
- version := "0.1.4",
- scalaVersion := "2.11.8",
- name := "sourcecode" ,
- organization := "com.lihaoyi",
- libraryDependencies ++= macroDependencies(scalaVersion.value),
- unmanagedSourceDirectories in Compile ++= {
- CrossVersion.partialVersion(scalaVersion.value) match {
- case Some((2, n)) if n >= 12 =>
- Seq(baseDirectory.value / ".."/"shared"/"src"/ "main" / "scala-2.11")
- case _ =>
- Seq()
- }
- },
- publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
-
- pomExtra :=
- https://github.com/lihaoyi/sourcecode
-
-
- MIT license
- http://www.opensource.org/licenses/mit-license.php
-
-
-
- git://github.com/lihaoyi/sourcecode.git
- scm:git://github.com/lihaoyi/sourcecode.git
-
-
-
- lihaoyi
- Li Haoyi
- https://github.com/lihaoyi
-
-
-).enablePlugins(SbtOsgi).settings(osgiSettings).settings(
- exportPackage := Seq("sourcecode.*"),
- privatePackage := Seq(),
- dynamicImportPackage := Seq("*")
-)
+lazy val sourcecode = crossProject(JSPlatform, JVMPlatform, NativePlatform)
+ .settings(
+ baseSettings,
+ libraryDependencies ++= macroDependencies(scalaVersion.value),
+ test in Test := (run in Test).toTask("").value,
+ unmanagedSourceDirectories in Compile ++= {
+ CrossVersion.partialVersion(scalaVersion.value) match {
+ case Some((2, n)) if n >= 12 =>
+ Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-2.11")
+ case _ =>
+ Seq()
+ }
+ },
+ // Osgi settings
+ osgiSettings,
+ exportPackage := Seq("sourcecode.*"),
+ privatePackage := Seq(),
+ dynamicImportPackage := Seq("*")
+ )
+ .enablePlugins(SbtOsgi)
+ .jsSettings(
+ scalaJSUseMainModuleInitializer in Test := true // use JVM-style main.
+ )
+ .nativeSettings(
+ crossScalaVersions := Seq(scala211)
+ )
lazy val js = sourcecode.js
lazy val jvm = sourcecode.jvm
+lazy val native = sourcecode.native
diff --git a/project/build.properties b/project/build.properties
index 27e88aa..64317fd 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=0.13.13
+sbt.version=0.13.15
diff --git a/project/build.sbt b/project/build.sbt
index 173f9d8..9e7adc8 100644
--- a/project/build.sbt
+++ b/project/build.sbt
@@ -1,2 +1,6 @@
-addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")
+addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5")
+addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.18")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.8.0")
+addSbtPlugin("org.scala-native" % "sbt-crossproject" % "0.2.0")
+addSbtPlugin("org.scala-native" % "sbt-scalajs-crossproject" % "0.2.0")
+addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.1")
diff --git a/sourcecode/js/src/test/scala/sourcecode/Main.scala b/sourcecode/js/src/test/scala/sourcecode/Main.scala
deleted file mode 100644
index 45dc90d..0000000
--- a/sourcecode/js/src/test/scala/sourcecode/Main.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-package sourcecode
-
-object Main extends scalajs.js.JSApp{
- def main(): Unit = {
- Tests.run()
- }
-}
-
-
diff --git a/sourcecode/jvm/src/test/scala/sourcecode/Main.scala b/sourcecode/shared/src/test/scala/sourcecode/Main.scala
similarity index 100%
rename from sourcecode/jvm/src/test/scala/sourcecode/Main.scala
rename to sourcecode/shared/src/test/scala/sourcecode/Main.scala