diff --git a/.travis.yml b/.travis.yml index 501e32d6..fc712cd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ before_install: env: global: - - PUBLISH_JDK=openjdk6 # PGP_PASSPHRASE - secure: "SkBtn/6OjEldoikn0MFuyeLT/pau27kwKSDYTVQeJ4BKDzdWLwLE5Q3RukLGttIfNdhOvRoocpQSW9GkZfibTHmwrRnAokucfZCqTsKbwoOp1xIoOh5GrrVrB6gcP7WBTKinqFdBgSvLOrP7GviImz4ZuB9wq1r+mToGG4pDrXc=" # SONA_USER @@ -21,7 +20,6 @@ script: admin/build.sh jdk: - openjdk6 - - openjdk7 - oraclejdk8 notifications: diff --git a/admin/README.md b/admin/README.md index 55ae9c8a..7f38379a 100644 --- a/admin/README.md +++ b/admin/README.md @@ -19,7 +19,7 @@ To configure tag driven releases from Travis CI. Edit `.travis.yml` as prompted. 4. Edit `.travis.yml` to use `./admin/build.sh` as the build script, and edit that script to use the tasks required for this project. - 5. Edit `.travis.yml` to select which JDK will be used for publishing. + 5. Edit `build.sbt` to select which JDK will be used for publishing. It is important to add comments in .travis.yml to identify the name of each environment variable encoded in a `:secure` section. @@ -30,7 +30,6 @@ form: language: scala env: global: - - PUBLISH_JDK=openjdk6 # PGP_PASSPHRASE - secure: "XXXXXX" # SONA_USER diff --git a/admin/build.sh b/admin/build.sh index ddd6d5e0..ce76249d 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -7,7 +7,7 @@ set -e # git on travis does not fetch tags, but we have TRAVIS_TAG # headTag=$(git describe --exact-match ||:) -if [ "$TRAVIS_JDK_VERSION" == "$PUBLISH_JDK" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then +if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then echo "Going to release from tag $TRAVIS_TAG!" myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) publishVersion='set every version := "'$myVer'"' diff --git a/build.sbt b/build.sbt index a4f93bcf..0e3d33f7 100644 --- a/build.sbt +++ b/build.sbt @@ -1,13 +1,23 @@ scalaVersion in ThisBuild := crossScalaVersions.value.head crossScalaVersions in ThisBuild := { + val v211 = List("2.11.8") + val v212 = List("2.12.0-RC1") + val javaVersion = System.getProperty("java.version") - val isJDK6Or7 = - javaVersion.startsWith("1.6.") || javaVersion.startsWith("1.7.") - if (isJDK6Or7) - Seq("2.11.8") - else - Seq("2.11.8", "2.12.0-RC1") + val isTravisPublishing = !util.Properties.envOrElse("TRAVIS_TAG", "").trim.isEmpty + + if (isTravisPublishing) { + if (javaVersion.startsWith("1.6.")) v211 + else if (javaVersion.startsWith("1.8.")) v212 + else Nil + } else if (javaVersion.startsWith("1.6.") || javaVersion.startsWith("1.7.")) { + v211 + } else if (javaVersion.startsWith("1.8.") || javaVersion.startsWith("9")) { + v211 ++ v212 + } else { + sys.error(s"Unsupported java version: $javaVersion.") + } } lazy val `scala-parser-combinators` = crossProject.in(file(".")).