Skip to content

Commit b71f12e

Browse files
authored
Merge pull request #86 from gourlaysama/publishing
Redo how cross-version publishing works
2 parents 0b01f43 + cdfba62 commit b71f12e

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ before_install:
99

1010
env:
1111
global:
12-
- PUBLISH_JDK=openjdk6
1312
# PGP_PASSPHRASE
1413
- secure: "SkBtn/6OjEldoikn0MFuyeLT/pau27kwKSDYTVQeJ4BKDzdWLwLE5Q3RukLGttIfNdhOvRoocpQSW9GkZfibTHmwrRnAokucfZCqTsKbwoOp1xIoOh5GrrVrB6gcP7WBTKinqFdBgSvLOrP7GviImz4ZuB9wq1r+mToGG4pDrXc="
1514
# SONA_USER
@@ -21,7 +20,6 @@ script: admin/build.sh
2120

2221
jdk:
2322
- openjdk6
24-
- openjdk7
2523
- oraclejdk8
2624

2725
notifications:

admin/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To configure tag driven releases from Travis CI.
1919
Edit `.travis.yml` as prompted.
2020
4. Edit `.travis.yml` to use `./admin/build.sh` as the build script,
2121
and edit that script to use the tasks required for this project.
22-
5. Edit `.travis.yml` to select which JDK will be used for publishing.
22+
5. Edit `build.sbt` to select which JDK will be used for publishing.
2323

2424
It is important to add comments in .travis.yml to identify the name
2525
of each environment variable encoded in a `:secure` section.
@@ -30,7 +30,6 @@ form:
3030
language: scala
3131
env:
3232
global:
33-
- PUBLISH_JDK=openjdk6
3433
# PGP_PASSPHRASE
3534
- secure: "XXXXXX"
3635
# SONA_USER

admin/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -e
77
# git on travis does not fetch tags, but we have TRAVIS_TAG
88
# headTag=$(git describe --exact-match ||:)
99

10-
if [ "$TRAVIS_JDK_VERSION" == "$PUBLISH_JDK" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then
10+
if [[ "$TRAVIS_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)? ]]; then
1111
echo "Going to release from tag $TRAVIS_TAG!"
1212
myVer=$(echo $TRAVIS_TAG | sed -e s/^v//)
1313
publishVersion='set every version := "'$myVer'"'

build.sbt

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
scalaVersion in ThisBuild := crossScalaVersions.value.head
22

33
crossScalaVersions in ThisBuild := {
4+
val v211 = List("2.11.8")
5+
val v212 = List("2.12.0-RC1")
6+
47
val javaVersion = System.getProperty("java.version")
5-
val isJDK6Or7 =
6-
javaVersion.startsWith("1.6.") || javaVersion.startsWith("1.7.")
7-
if (isJDK6Or7)
8-
Seq("2.11.8")
9-
else
10-
Seq("2.11.8", "2.12.0-RC1")
8+
val isTravisPublishing = !util.Properties.envOrElse("TRAVIS_TAG", "").trim.isEmpty
9+
10+
if (isTravisPublishing) {
11+
if (javaVersion.startsWith("1.6.")) v211
12+
else if (javaVersion.startsWith("1.8.")) v212
13+
else Nil
14+
} else if (javaVersion.startsWith("1.6.") || javaVersion.startsWith("1.7.")) {
15+
v211
16+
} else if (javaVersion.startsWith("1.8.") || javaVersion.startsWith("9")) {
17+
v211 ++ v212
18+
} else {
19+
sys.error(s"Unsupported java version: $javaVersion.")
20+
}
1121
}
1222

1323
lazy val `scala-parser-combinators` = crossProject.in(file(".")).

0 commit comments

Comments
 (0)