Skip to content

Commit d7912af

Browse files
committed
Move build matrix to .travis.yml: no more ScalaVersionByJvm.
This does the same thing as scala-xml#223 but for parser-combinators: * the matrix build is moved to .travis.yml, with * jdk 6, 8 and 11 * scala 2.11.12, 2.12.7 and 2.13.0-M5 * JVM, JS 0.6.25 (and JS 1.0.0-M5 eventually) * a few combinations are disabled when not supported or superfluous * re-publishing is done by adding a commit above a tag with the version change and pushing a new tag * ScalaVersionByJvm is not used, crossScalaVersion is enough This should make adding back scala-native support very easy.
1 parent e27d308 commit d7912af

File tree

4 files changed

+62
-47
lines changed

4 files changed

+62
-47
lines changed

.travis.yml

+21
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ env:
1919
- secure: "JSv/Er6q1XtTpRH1bpU63YBf7ufwg0vW+Kv/udQBtr8YX/P3gRYC1x6hW4uwftaKMYh7wXDkfNy51SRpH3kUptdJvjPUifVElyPiYlsumetmD+rZJmxX6agx+U5pdjIXPqPoton9MdSVHNTROeTu339bDak0Z+N5ht5wRfjP7F4="
2020
# SONA_PASS
2121
- secure: "OIVtcj7AHZr8Grpf03ZmZsygcADewiYIvSnRwLYCx+5AqOzs39EZ68DsIOxi7wEXVUbVj5RvLXpKzLX3iN+UszLOQRoFPFQyyn+3Y50f8T2aRxdZtInzXn0sCVTj4Hhd/zbKl1W+2Nh3Sqazab7tFoQVzEyYqhcPeiNRMF7h+aY="
22+
matrix:
23+
- SCALAJS_VERSION=
24+
- SCALAJS_VERSION=0.6.25
2225

2326
script:
2427
- echo $JAVA_HOME
@@ -37,6 +40,24 @@ jdk:
3740
- oraclejdk8
3841
- openjdk11
3942

43+
scala:
44+
- 2.11.12
45+
- 2.12.7
46+
- 2.13.0-M5
47+
48+
matrix:
49+
exclude:
50+
- jdk: openjdk11
51+
env: SCALAJS_VERSION=0.6.25
52+
- scala: 2.11.12
53+
jdk: oraclejdk8
54+
- scala: 2.11.12
55+
jdk: openjdk11
56+
- scala: 2.12.7
57+
jdk: openjdk6
58+
- scala: 2.13.0-M5
59+
jdk: openjdk6
60+
4061
notifications:
4162
email:
4263

admin/build.sh

+34-30
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,58 @@ set -e
44

55
# Builds of tagged revisions are published to sonatype staging.
66

7-
# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice.
7+
# Travis runs a build on new revisions, including on new tags.
88
# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds.
99
# Checking the local git clone would not work because git on travis does not fetch tags.
1010

1111
# The version number to be published is extracted from the tag, e.g., v1.2.3 publishes
12-
# version 1.2.3 using all Scala versions in build.sbt's `crossScalaVersions`.
12+
# version 1.2.3 using all Scala versions in the travis matrix where
13+
# [ "$RELEASE_COMBO" = "true" ].
1314

14-
# When a new, binary incompatible Scala version becomes available, a previously released version
15-
# can be released using that new Scala version by creating a new tag containing the Scala and the
16-
# JVM version after hashes, e.g., v1.2.3#2.13.0-M1#8. The JVM version needs to be listed in
17-
# `.travis.yml`, otherwise the required build doesn't run.
15+
# In order to build a previously released version against a new (binary incompatible) Scala release,
16+
# a new commit that modifies (and prunes) the Scala versions in .travis.yml needs to be added on top
17+
# of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`.
18+
# Everything after the `#` in the tag name is ignored.
19+
20+
if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* \
21+
|| "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then
22+
RELEASE_COMBO=true;
23+
fi
24+
25+
if [ "$SCALAJS_VERSION" = "" ]; then
26+
projectPrefix="scala-parser-combinators"
27+
else
28+
projectPrefix="scala-parser-combinatorsJS"
29+
fi
1830

1931
verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?"
2032
tagPat="^v$verPat(#$verPat#[0-9]+)?$"
2133

2234
if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
23-
currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//')
24-
25-
tagVer=$(echo $TRAVIS_TAG | sed s/#.*// | sed s/^v//)
35+
tagVer=${TRAVIS_TAG}
36+
tagVer=${tagVer#v} # Remove `v` at beginning.
37+
tagVer=${tagVer%%#*} # Remove anything after `#`.
2638
publishVersion='set every version := "'$tagVer'"'
2739

28-
scalaAndJvmVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//)
29-
if [ "$scalaAndJvmVer" != "" ]; then
30-
scalaVer=$(echo $scalaAndJvmVer | sed s/#.*//)
31-
jvmVer=$(echo $scalaAndJvmVer | sed s/[^#]*// | sed s/^#//)
32-
if [ "$jvmVer" != "$currentJvmVer" ]; then
33-
echo "Not publishing $TRAVIS_TAG on Java version $currentJvmVer."
34-
exit 0
35-
fi
36-
publishScalaVersion='set every ScalaModulePlugin.scalaVersionsByJvm := Map('$jvmVer' -> List("'$scalaVer'" -> true))'
37-
echo "Releasing $tagVer using Scala $scalaVer on Java version $jvmVer."
38-
else
39-
echo "Releasing $tagVer on Java version $currentJvmVer according to 'scalaVersionsByJvm' in build.sbt."
40-
fi
40+
if [ "$RELEASE_COMBO" = "true" ]; then
41+
currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//')
42+
echo "Releasing $tagVer with Scala $TRAVIS_SCALA_VERSION on Java version $currentJvmVer."
4143

42-
extraTarget="+publish-signed"
43-
cat admin/gpg.sbt >> project/plugins.sbt
44-
cp admin/publish-settings.sbt .
44+
publishTask="$projectPrefix/publish-signed"
4545

46-
# Copied from the output of genKeyPair.sh
47-
K=$encrypted_5e972ec514e2_key
48-
IV=$encrypted_5e972ec514e2_iv
46+
cat admin/gpg.sbt >> project/plugins.sbt
47+
cp admin/publish-settings.sbt .
4948

50-
openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d
49+
# Copied from the output of genKeyPair.sh
50+
K=$encrypted_5e972ec514e2_key
51+
IV=$encrypted_5e972ec514e2_iv
52+
53+
openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d
54+
fi
5155
fi
5256

5357
if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" ]]; then
5458
SBTOPTS="-Dsbt.override.build.repos=true -Dsbt.repository.config=./.sbtrepos"
5559
fi
5660

57-
sbt $SBTOPTS "$publishVersion" "$publishScalaVersion" clean update +test +publishLocal $extraTarget
61+
sbt $SBTOPTS "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/update" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask"

build.sbt

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
11
import ScalaModulePlugin._
22
import sbtcrossproject.crossProject
33

4-
scalaVersionsByJvm in ThisBuild := {
5-
val v211 = "2.11.12"
6-
val v212 = "2.12.7"
7-
val v213 = "2.13.0-M5"
8-
9-
val allFalse = List(v212 -> false, v213 -> false, v211 -> false)
10-
Map(
11-
6 -> List(v211 -> true),
12-
7 -> List(v211 -> false),
13-
8 -> List(v212 -> true, v213 -> true, v211 -> false),
14-
9 -> allFalse,
15-
10 -> allFalse,
16-
11 -> allFalse
17-
)
18-
}
4+
crossScalaVersions in ThisBuild := List("2.12.7", "2.11.12", "2.13.0-M5")
195

206
lazy val root = project.in(file("."))
217
.aggregate(`scala-parser-combinatorsJS`, `scala-parser-combinatorsJVM`)
228
.settings(disablePublishing)
239

24-
lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform).in(file(".")).
10+
lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform).
11+
withoutSuffixFor(JVMPlatform).in(file(".")).
2512
settings(scalaModuleSettings: _*).
2613
jvmSettings(scalaModuleSettingsJVM).
2714
settings(

project/plugins.sbt

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ else
77

88
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14")
99

10-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")
10+
val scalaJSVersion =
11+
Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.25")
12+
13+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
1114

1215
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")

0 commit comments

Comments
 (0)