Skip to content

No longer use scalaVersionsByJvm #223

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 5 commits into from
May 23, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
*.jar
*~

build.properties

# target directories for ant build
/build/
/dists/
Expand Down
41 changes: 28 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# opt-in to Travis's newer/faster container-based infrastructure
sudo: false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should switch to Travis's newer Ubuntu precise infrastructure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd stick with the defaults unless there's a good reason not to, but I also don't have a strong opinion. Either way is fine with me.

language: scala

addons:
apt:
packages:
- openjdk-6-jdk

jdk:
- openjdk6
- oraclejdk8
- oraclejdk9

scala:
- 2.11.12
- 2.12.4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.12.6???

- 2.13.0-M3

env:
global:
# PGP_PASSPHRASE
Expand All @@ -11,18 +23,21 @@ env:
- secure: "OpBwPc1GNvauageYOH3RscAa7wpZxgpmqDz15aigIKLNWzAhAtVUx0MleZ8rQeoqml6nrAvlnzuVHjKL2lVcjMPpjUis7bcQ5UAGK7tZK8x+qZNQxXmpXu8+pENwQA2yFaqt/xy7K5jFOrHJHTRxcPnyVG1yKakPWz53PPYUwbc="
# SONA_PASS
- secure: "Xw7rI/qlML1nD2e2XwlakkhKAWNGZKqqE+Q3ntTvFpfHryl7KLCvVzJ4LIavnL6kGJaWOgy9vlSoEWn5g9nqHSfE31C/k5pY5nTMAKiwiJzfAS+r0asKXW2gmKhwtcTBkqyLVOZLCJSPVlFRQyfBJHY+Fs0L3KWcnMQgtBlyDhU="
matrix:
- SCALAJS_VERSION=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the significance of an empty SCALAJS_VERSION?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it builds for the JVM. If SCALAJS_VERSION is non-empty, the build only builds for JS. See https://github.com/scala/scala-xml/pull/223/files#diff-3acefdae08499733e855dd23e1af933dR19.

On travis, every combination of the biuld matrix has its own "job", see https://travis-ci.org/scala/scala-xml/builds/381095011 for example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tricky.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we'll blame the code smell on @SethTisue, then. :-)

- SCALAJS_VERSION=0.6.23
- SCALAJS_VERSION=1.0.0-M3

script: admin/build.sh

addons:
apt:
packages:
- openjdk-6-jdk
matrix:
exclude:
- scala: 2.13.0-M3
env: SCALAJS_VERSION=1.0.0-M3
- scala: 2.12.4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.12.6, again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, sorry I missed these..

jdk: openjdk6
- scala: 2.13.0-M3
jdk: openjdk6
Copy link
Member

@ashawley ashawley May 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 19 builds at the moment. Do we really need all of them?

Trimming down would be nice, because the wall time used to be 10 minutes for 3 concurrent builds. The individuals builds are shorter, but now it looks like it takes over 20 minutes because Travis throttles only to 4 or 5 concurrent builds.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not wrong to test them. Maybe we could skip combinations that contain two preview versions: Scala-js 1.0.0-M3 & openjdk9.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sounds like a good start.

I'm thinking ahead to #110 when things will really go downhill.


jdk:
- openjdk6
- oraclejdk8
- oraclejdk9
script: admin/build.sh

notifications:
email: [email protected]
Expand Down
33 changes: 15 additions & 18 deletions admin/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
## Tag Driven Releasing

### Background Reading

- http://docs.travis-ci.com/user/environment-variables/
- http://docs.travis-ci.com/user/encryption-keys/
- http://docs.travis-ci.com/user/encrypting-files/

### Initial setup for the repository

To configure tag driven releases from Travis CI.

1. Generate a key pair for this repository with `./admin/genKeyPair.sh`.
Edit `.travis.yml` and `admin/build.sh` as prompted.
1. Publish the public key to https://pgp.mit.edu
1. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`.
1. Store other secrets as encrypted environment variables with `./admin/encryptEnvVars.sh`.
Edit `.travis.yml` as prompted.
1. Edit `.travis.yml` to use `./admin/build.sh` as the build script,
and edit that script to use the tasks required for this project.
1. Edit `build.sbt`'s `scalaVersionsByJvm in ThisBuild` to select Scala and JVM version
combinations that will be used for publishing.
Ensure that `RELEASE_COMBO` is `true` for build matrix combinations
that should be released to sonatype (when building a tag).

It is important to add comments in `.travis.yml` to identify the name
of each environment variable encoded in a `:secure` section.
of each environment variable encoded in a `secure` section.

After these steps, your `.travis.yml` should contain config of the form:

```
language: scala

jdk:
- openjdk6
- oraclejdk8

scala:
- 2.11.12
- 2.12.6

env:
global:
# PGP_PASSPHRASE
Expand All @@ -39,10 +41,6 @@ env:

script: admin/build.sh

jdk:
- openjdk6
- oraclejdk8

notifications:
email:
- [email protected]
Expand All @@ -62,10 +60,9 @@ without generating a new key.
1. Create a GitHub "Release" with a corresponding tag (e.g., `v0.1.1`) via the GitHub
web interface.
1. The release will be published using the Scala and JVM version combinations specified
in `scalaVersionsByJvm` in `build.sbt`.
- If you need to release against a different Scala version, include the Scala version
and the JVM version to use in the tag name, separated by `#`s (e.g., `v0.1.1#2.13.0-M1#8`).
Note that the JVM version needs to be listed in `.travis.yml` for the build to run.
in the travis build matrix where `[ "$RELEASE_COMBO" = "true" ]`.
- If you need to release against a different Scala version, create a new commit that modifies
`.travis.yml` and push a new tag, e.g., `v1.2.3#2.13.0-M5`. The suffix after `#` is ignored.
1. Travis CI will schedule a build for this release. Review the build logs.
1. Log into https://oss.sonatype.org/ and identify the staging repository.
1. Sanity check its contents.
Expand Down
57 changes: 28 additions & 29 deletions admin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,44 @@ set -e
# Checking the local git clone would not work because git on travis does not fetch tags.

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

# When a new, binary incompatible Scala version becomes available, a previously released version
# can be released using that new Scala version by creating a new tag containing the Scala and the
# JVM version after hashes, e.g., v1.2.3#2.13.0-M1#8. The JVM version needs to be listed in
# `.travis.yml`, otherwise the required build doesn't run.
# In order to build a previously released version against a new (binary incompatible) Scala release,
# a new commit that modifies (and prunes) the Scala versions in .travis.yml needs to be added on top
# of the existing tag. Then a new tag can be created for that commit, e.g., `v1.2.3#2.13.0-M5`.
# Everything after the `#` in the tag name is ignored.

if [[ "$TRAVIS_JDK_VERSION" == "openjdk6" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* || "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.1[23]\..* ]]; then
RELEASE_COMBO=true;
fi

if [ "$SCALAJS_VERSION" = "" ]; then
projectPrefix="xml"
else
projectPrefix="xmlJS"
fi

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

if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//')

tagVer=$(echo $TRAVIS_TAG | sed s/#.*// | sed s/^v//)
publishVersion='set every version := "'$tagVer'"'

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

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

# Copied from the output of genKeyPair.sh
K=$encrypted_6b8d67feaab7_key
IV=$encrypted_6b8d67feaab7_iv
cat admin/gpg.sbt >> project/plugins.sbt
cp admin/publish-settings.sbt .

openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d
# Copied from the output of genKeyPair.sh
K=$encrypted_6b8d67feaab7_key
IV=$encrypted_6b8d67feaab7_iv
openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d
fi
fi

sbt "$publishVersion" "$publishScalaVersion" clean update +test +publishLocal $extraTarget
sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/clean" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to see the update task go.

I don't know if "$projectPrefix/clean" is a worthwhile distinction.

But these are nits.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update runs anways as part of test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I like the timestamp and success of each task I guess.

13 changes: 6 additions & 7 deletions admin/publish-settings.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
def env(key: String) = Option(System.getenv(key)).getOrElse("")

pgpPassphrase := Some(env("PGP_PASSPHRASE").toArray)

pgpPublicRing := file("admin/pubring.asc")

pgpSecretRing := file("admin/secring.asc")

credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS"))
inThisBuild(Seq(
pgpPassphrase := Some(env("PGP_PASSPHRASE").toArray),
pgpPublicRing := file("admin/pubring.asc"),
pgpSecretRing := file("admin/secring.asc"),
credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS"))
))
27 changes: 10 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import sbtcrossproject.{crossProject, CrossType}
import ScalaModulePlugin._

scalaVersionsByJvm in ThisBuild := {
val v211 = "2.11.12"
val v212 = "2.12.4"
val v213 = "2.13.0-M3"
Map(
6 -> List(v211 -> true),
7 -> List(v211 -> false),
8 -> List(v212 -> true, v213 -> true, v211 -> false),
9 -> List(v212 -> false, v213 -> false, v211 -> false))
}
crossScalaVersions in ThisBuild := List("2.12.6", "2.11.12", "2.13.0-M3")

lazy val root = project.in(file("."))
.aggregate(xmlJS, xmlJVM)
.settings(disablePublishing)

lazy val xml = crossProject.in(file("."))
lazy val xml = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.in(file("."))
.settings(scalaModuleSettings)
.jvmSettings(scalaModuleSettingsJVM)
.settings(
Expand All @@ -27,7 +18,10 @@ lazy val xml = crossProject.in(file("."))
scalacOptions ++= "-deprecation:false -feature -Xlint:-stars-align,-nullary-unit,_".split("\\s+").to[Seq],
scalacOptions in Test += "-Xxml:coalescing",

mimaPreviousVersion := Some("1.1.0"),
mimaPreviousVersion := {
if (System.getenv("SCALAJS_VERSION") == "1.0.0-M3") None // No such release yet
else Some("1.1.0")
},

apiMappings ++= Map(
scalaInstance.value.libraryJar
Expand All @@ -48,7 +42,6 @@ lazy val xml = crossProject.in(file("."))
-> url("http://docs.oracle.com/javase/9/docs/api"),
file("/modules/java.xml")
-> url("http://docs.oracle.com/javase/9/docs/api")

)
}
}
Expand Down
9 changes: 6 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14")

if (System.getProperty("java.version").startsWith("1."))
Seq()
else
// override to version that works on Java 9,
// see https://github.com/scala/sbt-scala-module/issues/35
Seq(addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3"))

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.23")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.4.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this about?

[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn] 
[warn] 	* org.scala-js:sbt-scalajs:0.6.23 is selected over 0.6.22
[warn] 	    +- default:scala-xml-build:0.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13) (depends on 0.6.23)
[warn] 	    +- org.portable-scala:sbt-scalajs-crossproject:0.4.0 (scalaVersion=2.10, sbtVersion=0.13) (depends on 0.6.22)
[warn] 
[warn] 	* org.portable-scala:sbt-platform-deps:1.0.0 is selected over 1.0.0-M2
[warn] 	    +- org.scala-js:sbt-scalajs:0.6.23 (scalaVersion=2.10, sbtVersion=0.13) (depends on 1.0.0)
[warn] 	    +- org.portable-scala:sbt-crossproject:0.4.0 (scalaVersion=2.10, sbtVersion=0.13) (depends on 1.0.0-M2)
[warn] 	    +- org.portable-scala:sbt-scalajs-crossproject:0.4.0 (scalaVersion=2.10, sbtVersion=0.13) (depends on 1.0.0-M2)
[warn] 
[warn] Run 'evicted' to see detailed eviction warnings

Why doesn't the sbt-scalajs-crossproject plugin just bring in the corresponding sbt-scalajs core plugin?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sbt-scalajs-crossproject is not only about scala-js, but also native. I don't know it very well, but the docs say that the js plugin should be added (https://github.com/portable-scala/sbt-crossproject). It would be nice if this warning didn't show up though..

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