Skip to content

Commit 84cef50

Browse files
committed
Merge branch 'master' of https://github.com/lihaoyi/sourcecode
2 parents 0ec08fa + f917ee8 commit 84cef50

File tree

7 files changed

+142
-19
lines changed

7 files changed

+142
-19
lines changed

.travis.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
language: scala
2+
sudo: required
3+
dist: trusty
24
script:
3-
- sbt ++$TRAVIS_SCALA_VERSION sourcecodeJVM/test:run sourcecodeJS/test:run
4-
scala:
5-
- 2.10.6
6-
- 2.11.11
7-
- 2.12.2
5+
# plz is like ++ except it skips projects that are not defined for that scala version.
6+
- sbt "plz $TRAVIS_SCALA_VERSION test"
87
jdk:
9-
- openjdk7
108
- oraclejdk8
119
env:
1210
- SCALAJS_VERSION=0.6.18
1311
- SCALAJS_VERSION=1.0.0-M1
12+
scala:
13+
- 2.10.6
14+
- 2.11.11
15+
- 2.12.2
16+
- 2.13.0-M1
1417
matrix:
15-
exclude:
16-
- scala: 2.12.2
18+
include:
19+
- scala: 2.10.6
1720
jdk: openjdk7
18-
sudo: false
21+
before_install:
22+
- bash bin/travis_setup.sh
23+
cache:
24+
directories:
25+
- $HOME/.sbt/0.13/dependency
26+
- $HOME/.sbt/boot/scala*
27+
- $HOME/.sbt/launchers
28+
- $HOME/.ivy2/cache
29+
- $HOME/.nvm
30+
before_cache:
31+
- du -h -d 1 $HOME/.ivy2/cache
32+
- du -h -d 2 $HOME/.sbt/
33+
- find $HOME/.sbt -name "*.lock" -type f -delete
34+
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SourceCode [![Build Status](https://travis-ci.org/lihaoyi/sourcecode.svg?branch=master)](https://travis-ci.org/lihaoyi/sourcecode) [![Join the chat at https://gitter.im/lihaoyi/Ammonite](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lihaoyi/sourcecode?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1+
SourceCode [![Build Status](https://travis-ci.org/lihaoyi/sourcecode.svg?branch=master)](https://travis-ci.org/lihaoyi/sourcecode) [![Join the chat at https://gitter.im/lihaoyi/Ammonite](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/lihaoyi/sourcecode?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Maven Central](https://img.shields.io/maven-central/v/com.lihaoyi/sourcecode_2.11.svg)](https://maven-badges.herokuapp.com/maven-central/com.lihaoyi/sourcecode_2.11)
22
==========
33

44
```scala

bin/travis_setup.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
# Original script from https://github.com/scala-native/scala-native/blob/c4eac0707bebc08f4979a0d0eaed16427b734171/bin/travis_setup.sh
3+
4+
# Enable strict mode and fail the script on non-zero exit code,
5+
# unresolved variable or pipe failure.
6+
set -euo pipefail
7+
IFS=$'\n\t'
8+
9+
if [ "$(uname)" == "Darwin" ]; then
10+
11+
brew update
12+
brew install sbt
13+
brew install bdw-gc
14+
brew link bdw-gc
15+
brew install jq
16+
brew install re2
17+
brew install llvm@4
18+
export PATH="/usr/local/opt/llvm@4/bin:$PATH"
19+
20+
else
21+
22+
# Install LLVM/Clang, Boehm GC, libunwind
23+
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
24+
sudo apt-get -qq update
25+
sudo apt-get install -y -qq \
26+
clang++-3.8 \
27+
libgc-dev \
28+
libunwind8-dev
29+
30+
# Install re2
31+
# Starting from Ubuntu 16.04 LTS, it'll be available as http://packages.ubuntu.com/xenial/libre2-dev
32+
sudo apt-get install -y make
33+
export CXX=clang++-3.8
34+
git clone https://code.googlesource.com/re2
35+
pushd re2
36+
git checkout 2017-03-01
37+
make -j4 test
38+
sudo make install prefix=/usr
39+
make testinstall prefix=/usr
40+
popd
41+
42+
fi

build.sbt

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,42 @@
1+
<<<<<<< HEAD
12
crossScalaVersions := Seq("2.10.6", "2.11.11", "2.12.2")
3+
=======
4+
import sbtcrossproject.{crossProject, CrossType}
5+
import OsgiKeys._
6+
7+
val scala210 = "2.10.6"
8+
val scala211 = "2.11.11"
9+
val scala212 = "2.12.2"
10+
val scala213 = "2.13.0-M1"
11+
val baseSettings = Seq(
12+
organization := "com.lihaoyi",
13+
name := "sourcecode",
14+
version := "0.1.4",
15+
scalaVersion := scala211,
16+
crossScalaVersions := Seq(scala210, scala211, scala212, scala213),
17+
scmInfo := Some(ScmInfo(
18+
browseUrl = url("https://github.com/lihaoyi/sourcecode"),
19+
connection = "scm:git:git@github.com:lihaoyi/sourcecode.git"
20+
)),
21+
homepage := Some(url("https://github.com/lihaoyi/sourcecode")),
22+
licenses := Seq("MIT" -> url("http://www.opensource.org/licenses/mit-license.html")),
23+
developers += Developer(
24+
email = "haoyi.sg@gmail.com",
25+
id = "lihaoyi",
26+
name = "Li Haoyi",
27+
url = url("https://github.com/lihaoyi")
28+
),
29+
publishTo := Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
30+
)
31+
lazy val noPublish = Seq(
32+
publishArtifact := false,
33+
publish := {},
34+
publishLocal := {}
35+
)
36+
37+
baseSettings
38+
noPublish
39+
>>>>>>> f917ee842958bc3dd99b51b1c71837a6e3cd8697
240

341
def macroDependencies(version: String) =
442
Seq(
@@ -11,6 +49,7 @@ def macroDependencies(version: String) =
1149
else
1250
Seq())
1351

52+
<<<<<<< HEAD
1453
lazy val sourcecode = crossProject.settings(
1554
version := "0.1.3",
1655
scalaVersion := "2.11.11",
@@ -49,6 +88,35 @@ lazy val sourcecode = crossProject.settings(
4988
).jsSettings(
5089
scalaJSUseMainModuleInitializer in Test := true
5190
)
91+
=======
92+
lazy val sourcecode = crossProject(JSPlatform, JVMPlatform, NativePlatform)
93+
.settings(
94+
baseSettings,
95+
libraryDependencies ++= macroDependencies(scalaVersion.value),
96+
test in Test := (run in Test).toTask("").value,
97+
unmanagedSourceDirectories in Compile ++= {
98+
CrossVersion.partialVersion(scalaVersion.value) match {
99+
case Some((2, n)) if n >= 12 =>
100+
Seq(baseDirectory.value / ".." / "shared" / "src" / "main" / "scala-2.11")
101+
case _ =>
102+
Seq()
103+
}
104+
},
105+
// Osgi settings
106+
osgiSettings,
107+
exportPackage := Seq("sourcecode.*"),
108+
privatePackage := Seq(),
109+
dynamicImportPackage := Seq("*")
110+
)
111+
.enablePlugins(SbtOsgi)
112+
.jsSettings(
113+
scalaJSUseMainModuleInitializer in Test := true // use JVM-style main.
114+
)
115+
.nativeSettings(
116+
crossScalaVersions := Seq(scala211)
117+
)
118+
>>>>>>> f917ee842958bc3dd99b51b1c71837a6e3cd8697
52119

53120
lazy val js = sourcecode.js
54121
lazy val jvm = sourcecode.jvm
122+
lazy val native = sourcecode.native

project/build.sbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ val scalaJSVersion =
22
Option(System.getenv("SCALAJS_VERSION")).getOrElse("0.6.18")
33

44
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
5+
6+
addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5")
7+
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.8.0")
8+
addSbtPlugin("org.scala-native" % "sbt-crossproject" % "0.2.0")
9+
addSbtPlugin("org.scala-native" % "sbt-scalajs-crossproject" % "0.2.0")
10+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.1")

sourcecode/js/src/test/scala/sourcecode/Main.scala

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)