From 77f200f2d8759524820c0bebd9ca2c1a8202b44d Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 25 Apr 2017 11:39:40 +0200 Subject: [PATCH 1/2] remove unused imports --- .../scala/scala/collection/parallel/CollectionConverters.scala | 2 +- .../main/scala/scala/collection/parallel/ParIterableLike.scala | 1 - core/src/main/scala/scala/collection/parallel/TaskSupport.scala | 1 - core/src/main/scala/scala/collection/parallel/Tasks.scala | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/main/scala/scala/collection/parallel/CollectionConverters.scala b/core/src/main/scala/scala/collection/parallel/CollectionConverters.scala index 1ef1191d..21d94ba0 100644 --- a/core/src/main/scala/scala/collection/parallel/CollectionConverters.scala +++ b/core/src/main/scala/scala/collection/parallel/CollectionConverters.scala @@ -10,7 +10,7 @@ package scala.collection.parallel import scala.language.implicitConversions import scala.{collection => sc} -import scala.collection.{mutable => scm, immutable => sci, concurrent => scc, generic => scg} +import scala.collection.{mutable => scm, immutable => sci, concurrent => scc} import scala.collection._ diff --git a/core/src/main/scala/scala/collection/parallel/ParIterableLike.scala b/core/src/main/scala/scala/collection/parallel/ParIterableLike.scala index b1f1eb92..f1d2c507 100644 --- a/core/src/main/scala/scala/collection/parallel/ParIterableLike.scala +++ b/core/src/main/scala/scala/collection/parallel/ParIterableLike.scala @@ -15,7 +15,6 @@ import scala.collection.mutable.Builder import scala.collection.mutable.ArrayBuffer import scala.collection.IterableLike import scala.collection.Parallel -import scala.collection.Parallelizable import scala.collection.CustomParallelizable import scala.collection.generic._ import scala.collection.GenIterableLike diff --git a/core/src/main/scala/scala/collection/parallel/TaskSupport.scala b/core/src/main/scala/scala/collection/parallel/TaskSupport.scala index c479e638..924d8b0c 100644 --- a/core/src/main/scala/scala/collection/parallel/TaskSupport.scala +++ b/core/src/main/scala/scala/collection/parallel/TaskSupport.scala @@ -9,7 +9,6 @@ package scala package collection.parallel -import java.util.concurrent.ThreadPoolExecutor import java.util.concurrent.ForkJoinPool import scala.concurrent.ExecutionContext diff --git a/core/src/main/scala/scala/collection/parallel/Tasks.scala b/core/src/main/scala/scala/collection/parallel/Tasks.scala index 7c1e9f99..87e918aa 100644 --- a/core/src/main/scala/scala/collection/parallel/Tasks.scala +++ b/core/src/main/scala/scala/collection/parallel/Tasks.scala @@ -9,7 +9,6 @@ package scala package collection.parallel -import java.util.concurrent.ThreadPoolExecutor import java.util.concurrent.{ForkJoinPool, RecursiveAction, ForkJoinWorkerThread} import scala.concurrent.ExecutionContext import scala.util.control.Breaks._ From 51eff60b1b54712a60dcdf62efbb568c4fadf431 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Thu, 20 Apr 2017 11:57:30 +0200 Subject: [PATCH 2/2] Allow building an existing tag against a new Scala version For tags of the form `v1.2.3-suffix#2.13.0-M1#8`, the build script releases version `1.2.3-suffix` using Scala version `2.13.0-M1` on Java version 8. This allows building an existing tag against a new Scala version. --- .travis.yml | 1 - admin/README.md | 71 +++++++++++++++++++++++----------------- admin/build.sh | 44 ++++++++++++++++++++----- build.sbt | 25 ++++++-------- project/build.properties | 2 +- project/plugins.sbt | 2 +- 6 files changed, 89 insertions(+), 56 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84584e65..060b447c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ sudo: required env: global: - - PUBLISH_JDK=oraclejdk8 # PGP_PASSPHRASE - secure: "aL0veasRyeyMG6GILAQlWdo7r7yEW3zuG5c79eCaO0j26EFSNHsW04gwEJrj1FNuD7YRTHxBQoUnaYF+lr8d9CVYS1+TkHmqIaYpbgkpVa4DY7WdCSaHdqr0C6FkBtCRhtFseS4db7HkT4EsJPFR42NR7/uo1pSY1V/SebanaRfMbCcBUOqzpFBIAHMOJzpFSO9EqAPI7MZKWT8iLU2gluhDAD/5LMG2iDsqUvuqWvCMPEV00a1G4Fq6O29KHYUTsGNgF8p+4GVRJgAxxQKydeNKDWuZ1cPGulxLTWSxlMlFtGuN1qEZUUbb93w+kgAXky5X7CkOcBEtQs8+XgiMc0DvZvxvprPHYyGBUr6dRo8f1ztZtcDr3IEVZ6brfTflCufvokHrfdcIdsRj7MYnVS8QWHikPBaSsMjsqLEOh0VjtQQ4DkmMSo1U0XIIzMm3U61xrSpdMQYhByFWJA63m3pxj0Qt80TGABB0zW4+sLZaAuX+tjF6mA2JncKqUausJ4LWMPmxh35/s0tTc7FzQsZUjTVZ3Kii80uZPtDhiyXcPfErXMIXj8EjPm6n8pM+/AMdb+FH9vAkZ/T6LW9TOZsPY9dNqyZcyXmJ2vvza9HTOzTTutOf1dVqx9rFXD89uIwH8OQtsVpk0X0Oo7ctlNNRURk/oWEuD4VW0L3PviY=" # SONA_USER diff --git a/admin/README.md b/admin/README.md index 55ae9c8a..46626b4e 100644 --- a/admin/README.md +++ b/admin/README.md @@ -1,7 +1,5 @@ ## Tag Driven Releasing -Copied from https://github.com/scala/scala-java8-compat/commit/4a6cfc97cd95227b86650410e1b632e5ff79335b. - ### Background Reading - http://docs.travis-ci.com/user/environment-variables/ @@ -14,48 +12,61 @@ 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. - 2. Publish the public key to https://pgp.mit.edu - 3. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`. + 1. Publish the public key to https://pgp.mit.edu + 1. Store other secrets as encrypted environment variables with `admin/encryptEnvVars.sh`. Edit `.travis.yml` as prompted. - 4. Edit `.travis.yml` to use `./admin/build.sh` as the build script, + 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. - 5. Edit `.travis.yml` to select which JDK will be used for publishing. + 1. Edit `build.sbt`'s `scalaVersionsByJvm in ThisBuild` to select Scala and JVM version + combinations that will be used for publishing. -It is important to add comments in .travis.yml to identify the name +It is important to add comments in `.travis.yml` to identify the name of each environment variable encoded in a `:secure` section. -After all of these steps, your .travis.yml should contain config of the -form: - - language: scala - env: - global: - - PUBLISH_JDK=openjdk6 - # PGP_PASSPHRASE - - secure: "XXXXXX" - # SONA_USER - - secure: "XXXXXX" - # SONA_PASS - - secure: "XXXXXX" - script: admin/build.sh +After these steps, your `.travis.yml` should contain config of the form: + +``` +language: scala + +env: + global: + # PGP_PASSPHRASE + - secure: "XXXXXX" + # SONA_USER + - secure: "XXXXXX" + # SONA_PASS + - secure: "XXXXXX" + +script: admin/build.sh + +jdk: + - openjdk6 + - oraclejdk8 + +notifications: + email: + - a@b.com +``` If Sonatype credentials change in the future, step 3 can be repeated without generating a new key. -Be sure to use SBT 0.13.7 or higher to avoid [#1430](https://github.com/sbt/sbt/issues/1430)! - ### Testing - 1. Follow the release process below to create a dummy release (e.g. 0.1.0-TEST1). + 1. Follow the release process below to create a dummy release (e.g., `v0.1.0-TEST1`). Confirm that the release was staged to Sonatype but do not release it to Maven central. Instead, drop the staging repository. ### Performing a release - 1. Create a GitHub "Release" (with a corresponding tag) via the GitHub + 1. Create a GitHub "Release" with a corresponding tag (e.g., `v0.1.1`) via the GitHub web interface. - 2. Travis CI will schedule a build for this release. Review the build logs. - 3. Log into https://oss.sonatype.org/ and identify the staging repository. - 4. Sanity check its contents - 5. Release staging repository to Maven and send out release announcement. - + 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. + 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. + 1. Release staging repository to Maven and send out release announcement. diff --git a/admin/build.sh b/admin/build.sh index 7225cffc..2dfdeff4 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -2,15 +2,43 @@ set -e -# prep environment for publish to sonatype staging if the HEAD commit is tagged +# Builds of tagged revisions are published to sonatype staging. -# git on travis does not fetch tags, but we have TRAVIS_TAG -# headTag=$(git describe --exact-match ||:) +# Travis runs a build on new revisions and on new tags, so a tagged revision is built twice. +# Builds for a tag have TRAVIS_TAG defined, which we use for identifying tagged builds. +# 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`. + +# 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. + +verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" +tagPat="^v$verPat(#$verPat#[0-9]+)?$" + +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 [ "$TRAVIS_JDK_VERSION" == "$PUBLISH_JDK" ] && [[ "$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'"' extraTarget="+publish-signed" cat admin/gpg.sbt >> project/plugins.sbt cp admin/publish-settings.sbt . @@ -22,4 +50,4 @@ if [ "$TRAVIS_JDK_VERSION" == "$PUBLISH_JDK" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9]+\. openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d fi -sbt "$publishVersion" clean update +test +checkHeaders +publishLocal $extraTarget +sbt "$publishVersion" "$publishScalaVersion" clean update +test +checkHeaders +publishLocal $extraTarget diff --git a/build.sbt b/build.sbt index ba4cd438..c853e850 100644 --- a/build.sbt +++ b/build.sbt @@ -1,23 +1,18 @@ -resolvers in ThisBuild += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/" +import ScalaModulePlugin._ -crossScalaVersions in ThisBuild := Seq("2.13.0-M1") +version in ThisBuild := "0.1.2-SNAPSHOT" -scalaVersion in ThisBuild := crossScalaVersions.value.head +scalaVersionsByJvm in ThisBuild := { + val v213 = "2.13.0-M1" + Map( + 8 -> List(v213 -> true), + 9 -> List(v213 -> false)) +} -version in ThisBuild := "0.1.2-SNAPSHOT" - -scalacOptions in ThisBuild ++= Seq("-deprecation", "-feature", "-Xfatal-warnings") +scalacOptions in ThisBuild ++= Seq("-deprecation", "-feature", "-Xfatal-warnings") cancelable in Global := true -val disablePublishing = Seq[Setting[_]]( - publishArtifact := false, - // The above is enough for Maven repos but it doesn't prevent publishing of ivy.xml files - publish := {}, - publishLocal := {}, - publishTo := Some(Resolver.file("devnull", file("/dev/null"))) -) - disablePublishing // in root /** Create an OSGi version range for standard Scala / Lightbend versioning @@ -30,7 +25,7 @@ def osgiVersionRange(version: String): String = def osgiImport(pattern: String, version: String): String = pattern + ";version=\"" + osgiVersionRange(version) + "\"" -lazy val core = project.in(file("core")).settings(scalaModuleSettings).settings(scalaModuleOsgiSettings).settings( +lazy val core = project.in(file("core")).settings(scalaModuleSettings).settings( name := "scala-parallel-collections", OsgiKeys.exportPackage := Seq( s"scala.collection.parallel.*;version=${version.value}", diff --git a/project/build.properties b/project/build.properties index 27e88aa1..64317fda 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.13 +sbt.version=0.13.15 diff --git a/project/plugins.sbt b/project/plugins.sbt index f05510c0..55993d22 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.4") +addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.8") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "1.8.0")