Skip to content

Redo how cross-version publishing works #86

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

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ before_install:

env:
global:
- PUBLISH_JDK=openjdk6
# PGP_PASSPHRASE
- secure: "SkBtn/6OjEldoikn0MFuyeLT/pau27kwKSDYTVQeJ4BKDzdWLwLE5Q3RukLGttIfNdhOvRoocpQSW9GkZfibTHmwrRnAokucfZCqTsKbwoOp1xIoOh5GrrVrB6gcP7WBTKinqFdBgSvLOrP7GviImz4ZuB9wq1r+mToGG4pDrXc="
# SONA_USER
Expand All @@ -21,7 +20,6 @@ script: admin/build.sh

jdk:
- openjdk6
- openjdk7
- oraclejdk8

notifications:
Expand Down
3 changes: 1 addition & 2 deletions admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -30,7 +30,6 @@ form:
language: scala
env:
global:
- PUBLISH_JDK=openjdk6
# PGP_PASSPHRASE
- secure: "XXXXXX"
# SONA_USER
Expand Down
2 changes: 1 addition & 1 deletion admin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'"'
Expand Down
22 changes: 16 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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(".")).
Expand Down