-
Notifications
You must be signed in to change notification settings - Fork 76
Support for scalanative #29
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cb78258
basic builds working
harshad-deo f69d7c7
add testall command for cross testing
harshad-deo e04ebfa
add scalac options, fix feature and deprecation warnings in lib
harshad-deo 6b0cddf
update travis script
harshad-deo 11b4bf4
sbt version bump
harshad-deo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
language: scala | ||
script: | ||
- sbt ++$TRAVIS_SCALA_VERSION sourcecodeJVM/test:run sourcecodeJS/test:run | ||
|
||
scala: | ||
- 2.10.6 | ||
- 2.11.8 | ||
- 2.12.0 | ||
- 2.11.11 | ||
|
||
sudo: true | ||
|
||
jdk: | ||
- openjdk7 | ||
- oraclejdk8 | ||
matrix: | ||
exclude: | ||
- scala: 2.12.0 | ||
jdk: openjdk7 | ||
sudo: false | ||
|
||
before_install: | ||
- sudo apt-get -qq update | ||
- sudo apt-get install -y nodejs | ||
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.7 main' >> /etc/apt/sources.list" | ||
- sudo sh -c "echo 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' >> /etc/apt/sources.list" | ||
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - | ||
- sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test | ||
- sudo apt-get -qq update | ||
- sudo apt-get install -y libgc-dev clang++-3.7 llvm-3.7 llvm-3.7-dev llvm-3.7-runtime llvm-3.7-tool libunwind7-dev | ||
|
||
script: | ||
- sbt testall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
import sbtcrossproject.{crossProject, CrossType} | ||
|
||
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0") | ||
lazy val testAllCommand = Command.command("testall"){state => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can also do .nativeSetting(
crossScalaVersions --= Seq("2.10.6", "2.12.2")
) |
||
"project sourcecodeNative" :: "clean" :: "test:run" :: | ||
"project sourcecodeJVM" :: "clean" :: "+test:run" :: | ||
"project sourcecodeJS" :: "clean" :: "+test:run" :: | ||
state | ||
} | ||
|
||
commands += testAllCommand | ||
|
||
lazy val crossVersions = Seq("2.10.6", "2.11.11", "2.12.2") | ||
|
||
def macroDependencies(version: String) = | ||
Seq( | ||
|
@@ -12,42 +22,75 @@ def macroDependencies(version: String) = | |
else | ||
Seq()) | ||
|
||
lazy val sourcecode = crossProject.settings( | ||
version := "0.1.3", | ||
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 := | ||
<url>https://github.com/lihaoyi/sourcecode</url> | ||
<licenses> | ||
<license> | ||
<name>MIT license</name> | ||
<url>http://www.opensource.org/licenses/mit-license.php</url> | ||
</license> | ||
</licenses> | ||
<scm> | ||
<url>git://github.com/lihaoyi/sourcecode.git</url> | ||
<connection>scm:git://github.com/lihaoyi/sourcecode.git</connection> | ||
</scm> | ||
<developers> | ||
<developer> | ||
<id>lihaoyi</id> | ||
<name>Li Haoyi</name> | ||
<url>https://github.com/lihaoyi</url> | ||
</developer> | ||
</developers> | ||
lazy val commonScalacOptions = Seq( | ||
"-deprecation", | ||
"-unchecked", | ||
"-explaintypes", | ||
"-encoding", | ||
"UTF-8", | ||
"-feature", | ||
"-Xlog-reflective-calls", | ||
"-Ywarn-dead-code", | ||
"-Ywarn-inaccessible", | ||
"-Ywarn-value-discard", | ||
"-Xlint", | ||
"-Ywarn-nullary-override", | ||
"-Ywarn-nullary-unit", | ||
"-Xfuture" | ||
) | ||
|
||
lazy val js = sourcecode.js | ||
lazy val jvm = sourcecode.jvm | ||
lazy val scalacOptionsExt = Seq( | ||
"-Ywarn-infer-any", | ||
"-Ywarn-unused" | ||
) | ||
|
||
def scalacCompileOptions(version: String) = if(version.startsWith("2.10")) commonScalacOptions | ||
else scalacOptionsExt ++ commonScalacOptions | ||
|
||
lazy val sourcecode = crossProject(JSPlatform, JVMPlatform, NativePlatform) | ||
.settings( | ||
version := "0.1.4-SNAPSHOT", | ||
scalaVersion := "2.11.11", | ||
name := "sourcecode", | ||
organization := "com.lihaoyi", | ||
commands += testAllCommand, | ||
libraryDependencies ++= macroDependencies(scalaVersion.value), | ||
scalacOptions ++= scalacCompileOptions(scalaVersion.value), | ||
incOptions := incOptions.value.withLogRecompileOnMacro(false), | ||
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 := | ||
<url>https://github.com/lihaoyi/sourcecode</url> | ||
<licenses> | ||
<license> | ||
<name>MIT license</name> | ||
<url>http://www.opensource.org/licenses/mit-license.php</url> | ||
</license> | ||
</licenses> | ||
<scm> | ||
<url>git://github.com/lihaoyi/sourcecode.git</url> | ||
<connection>scm:git://github.com/lihaoyi/sourcecode.git</connection> | ||
</scm> | ||
<developers> | ||
<developer> | ||
<id>lihaoyi</id> | ||
<name>Li Haoyi</name> | ||
<url>https://github.com/lihaoyi</url> | ||
</developer> | ||
</developers> | ||
) | ||
|
||
lazy val js = sourcecode.js.settings( | ||
crossScalaVersions := crossVersions | ||
) | ||
lazy val jvm = sourcecode.jvm.settings( | ||
crossScalaVersions := crossVersions | ||
) | ||
lazy val native = sourcecode.native |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=0.13.13 | ||
sbt.version=0.13.15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13") | ||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15") | ||
|
||
addSbtPlugin("org.scala-native" % "sbt-crossproject" % "0.1.0") | ||
|
||
addSbtPlugin("org.scala-native" % "sbt-scalajs-crossproject" % "0.1.0") | ||
|
||
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.2.1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package sourcecode | ||
object Main{ | ||
def main(args: Array[String]): Unit = { | ||
Tests.run() | ||
} | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to install re2 see https://github.com/scala-native/scala-native/blob/master/.travis.yml#L28-L38