Skip to content

Commit

Permalink
fix java9 build (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k authored and tototoshi committed Jan 19, 2018
1 parent a20b830 commit afa0c03
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
26 changes: 1 addition & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,5 @@ matrix:
jdk: oraclejdk8
- scala: 2.13.0-M1
jdk: oraclejdk8
- dist: trusty
group: edge
sudo: required
scala: 2.12.2
- scala: 2.12.2
jdk: oraclejdk9
before_install:
- cd ~
- JDK9_URL=`curl http://jdk.java.net/9/ | grep "lin64JDK" | grep "tar.gz\"" | sed -e "s/\"/ /g" | awk '{print $5}'`
- wget -O jdk-9_linux-x64_bin.tar.gz $JDK9_URL
- tar -xzf jdk-9_linux-x64_bin.tar.gz
- cd -
script:
# https://github.com/sbt/sbt/pull/2951
- git clone https://github.com/retronym/java9-rt-export
- cd java9-rt-export/
- git checkout 1019a2873d057dd7214f4135e84283695728395d
- jdk_switcher use oraclejdk8
- sbt package
# - jdk_switcher use oraclejdk9
- export JAVA_HOME=~/jdk-9
- PATH=$JAVA_HOME/bin:$PATH
- mkdir -p $HOME/.sbt/0.13/java9-rt-ext; java -jar target/java9-rt-export-*.jar $HOME/.sbt/0.13/java9-rt-ext/rt.jar
- jar tf $HOME/.sbt/0.13/java9-rt-ext/rt.jar | grep java/lang/Object
- cd ..
- wget https://raw.githubusercontent.com/paulp/sbt-extras/9ade5fa54914ca8aded44105bf4b9a60966f3ccd/sbt && chmod +x ./sbt
- ./sbt -Dscala.ext.dirs=$HOME/.sbt/0.13/java9-rt-ext ++$TRAVIS_SCALA_VERSION test
10 changes: 4 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ javacOptions in compile ++= {
case Some((2, v)) if v <= 11 =>
Seq("-target", "6", "-source", "6")
case _ =>
try {
scala.util.Properties.isJavaAtLeast("1.8")
if (scala.util.Properties.isJavaAtLeast("9")) {
// if Java9
Nil
} else {
Seq("-target", "8")
} catch {
case _: NumberFormatException =>
// if Java9
Nil
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.15
sbt.version=0.13.17-RC1

0 comments on commit afa0c03

Please sign in to comment.