From 0935af98267b1c56cbff1f22e3ea72a4e1bb7c8b Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 26 Feb 2020 11:54:35 +0100 Subject: [PATCH] backport new publishing scripts based on sbt-ci-release --- .travis.yml | 50 ++++++++++---------------- admin/README.md | 72 ------------------------------------- admin/build.sh | 62 -------------------------------- admin/encryptEnvVars.sh | 11 ------ admin/genKeyPair.sh | 41 --------------------- admin/gpg.sbt | 1 - admin/publish-settings.sbt | 9 ----- admin/pubring.asc | 18 ---------- admin/secring.asc.enc | Bin 1888 -> 0 bytes build.sbt | 57 ++++++++++++++--------------- build.sh | 56 +++++++++++++++++++++++++++++ project/build.properties | 2 +- project/plugins.sbt | 14 ++++---- 13 files changed, 110 insertions(+), 283 deletions(-) delete mode 100644 admin/README.md delete mode 100755 admin/build.sh delete mode 100755 admin/encryptEnvVars.sh delete mode 100755 admin/genKeyPair.sh delete mode 100644 admin/gpg.sbt delete mode 100644 admin/publish-settings.sbt delete mode 100644 admin/pubring.asc delete mode 100644 admin/secring.asc.enc create mode 100755 build.sh diff --git a/.travis.yml b/.travis.yml index c2dea755..46d28257 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,48 +1,34 @@ -dist: trusty +version: ~> 1.0 # needed for imports + +import: scala/scala-dev:travis/default.yml + language: scala -jdk: - - oraclejdk8 - - openjdk11 scala: - 2.11.12 - - 2.12.8 - - 2.13.0 + - 2.12.10 + - 2.13.1 env: - global: - # PGP_PASSPHRASE - - secure: "SkBtn/6OjEldoikn0MFuyeLT/pau27kwKSDYTVQeJ4BKDzdWLwLE5Q3RukLGttIfNdhOvRoocpQSW9GkZfibTHmwrRnAokucfZCqTsKbwoOp1xIoOh5GrrVrB6gcP7WBTKinqFdBgSvLOrP7GviImz4ZuB9wq1r+mToGG4pDrXc=" - # SONA_USER - - secure: "JSv/Er6q1XtTpRH1bpU63YBf7ufwg0vW+Kv/udQBtr8YX/P3gRYC1x6hW4uwftaKMYh7wXDkfNy51SRpH3kUptdJvjPUifVElyPiYlsumetmD+rZJmxX6agx+U5pdjIXPqPoton9MdSVHNTROeTu339bDak0Z+N5ht5wRfjP7F4=" - # SONA_PASS - - secure: "OIVtcj7AHZr8Grpf03ZmZsygcADewiYIvSnRwLYCx+5AqOzs39EZ68DsIOxi7wEXVUbVj5RvLXpKzLX3iN+UszLOQRoFPFQyyn+3Y50f8T2aRxdZtInzXn0sCVTj4Hhd/zbKl1W+2Nh3Sqazab7tFoQVzEyYqhcPeiNRMF7h+aY=" - matrix: - # The empty SCALAJS_VERSION will only compile for the JVM - - SCALAJS_VERSION= - - SCALAJS_VERSION=0.6.28 - - SCALAJS_VERSION=1.0.0 + - ADOPTOPENJDK=8 SCALAJS_VERSION= + - ADOPTOPENJDK=8 SCALAJS_VERSION=0.6.32 + - ADOPTOPENJDK=8 SCALAJS_VERSION=1.0.0 + - ADOPTOPENJDK=11 SCALAJS_VERSION= matrix: include: - - env: SCALANATIVE_VERSION=0.3.9 - jdk: oraclejdk8 - - env: SCALANATIVE_VERSION=0.4.0-M2 - jdk: oraclejdk8 + - scala: 2.11.12 + env: ADOPTOPENJDK=8 SCALANATIVE_VERSION=0.3.9 + - scala: 2.11.12 + env: ADOPTOPENJDK=8 SCALANATIVE_VERSION=0.4.0-M2 -script: admin/build.sh +install: + - git fetch --tags # get all tags for sbt-dynver + +script: ./build.sh notifications: email: - adriaan.moors@lightbend.com - seth.tisue@lightbend.com - antoine@gourlay.fr - -before_cache: - - find $HOME/.sbt -name "*.lock" | xargs rm - - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt/boot - - $HOME/.sbt/launchers diff --git a/admin/README.md b/admin/README.md deleted file mode 100644 index dab2d1ea..00000000 --- a/admin/README.md +++ /dev/null @@ -1,72 +0,0 @@ -## 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`. - 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. - -It is important to add comments in `.travis.yml` to identify the name -of each environment variable encoded in a `:secure` section. - -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: - - oraclejdk8 - - openjdk11 - -notifications: - email: - - a@b.com -``` - -If Sonatype credentials change in the future, step 3 can be repeated -without generating a new key. - -### Testing - - 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 (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. - 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 deleted file mode 100755 index 20b54c20..00000000 --- a/admin/build.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -set -e - -# Builds of tagged revisions are published to sonatype staging. - -# Travis runs a build on new revisions, including on new tags. -# 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 the travis matrix where -# [ "$RELEASE_COMBO" = "true" ]. - -# 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 [[ "$SCALANATIVE_VERSION" != "" ]]; then - if [[ "$TRAVIS_JDK_VERSION" == "oraclejdk8" && "$TRAVIS_SCALA_VERSION" =~ 2\.11\..* ]]; then - RELEASE_COMBO=true; - fi -elif [[ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]]; then - RELEASE_COMBO=true; -fi - -if ! [ "$SCALAJS_VERSION" == "" ]; then - projectPrefix="scala-parser-combinatorsJS" -elif ! [ "$SCALANATIVE_VERSION" == "" ]; then - projectPrefix="scala-parser-combinatorsNative" -else - projectPrefix="scala-parser-combinators" -fi - -verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" -tagPat="^v$verPat(#$verPat#[0-9]+)?$" - -if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then - tagVer=${TRAVIS_TAG} - tagVer=${tagVer#v} # Remove `v` at beginning. - tagVer=${tagVer%%#*} # Remove anything after `#`. - publishVersion='set every version := "'$tagVer'"' - - 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." - - publishTask="$projectPrefix/publishSigned" - - cat admin/gpg.sbt >> project/plugins.sbt - cp admin/publish-settings.sbt . - - # Copied from the output of genKeyPair.sh - K=$encrypted_5e972ec514e2_key - IV=$encrypted_5e972ec514e2_iv - - openssl aes-256-cbc -K $K -iv $IV -in admin/secring.asc.enc -out admin/secring.asc -d - fi -fi - -sbt "++$TRAVIS_SCALA_VERSION" "$publishVersion" "$projectPrefix/update" "$projectPrefix/compile" "$projectPrefix/test" "$projectPrefix/publishLocal" "$publishTask" diff --git a/admin/encryptEnvVars.sh b/admin/encryptEnvVars.sh deleted file mode 100755 index b6256679..00000000 --- a/admin/encryptEnvVars.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# Encrypt sonatype credentials so that they can be -# decrypted in trusted builds on Travis CI. -# -set -e - -read -s -p 'SONA_USER: ' SONA_USER -travis encrypt SONA_USER="$SONA_USER" -read -s -p 'SONA_PASS: ' SONA_PASS -travis encrypt SONA_PASS="$SONA_PASS" diff --git a/admin/genKeyPair.sh b/admin/genKeyPair.sh deleted file mode 100755 index 17db3f39..00000000 --- a/admin/genKeyPair.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# Generates a key pair for this repository to sign artifacts. -# Encrypt the private key and its passphrase in trusted builds -# on Travis CI. -# -set -e - -# Based on https://gist.github.com/kzap/5819745: -function promptDelete() { - if [[ -f "$1" ]]; then - echo About to delete $1, Enter for okay / CTRL-C to cancel - read - rm "$1" - fi -} -for f in admin/secring.asc.enc admin/secring.asc admin/pubring.asc; do promptDelete "$f"; done - -echo Generating key pair. Please enter 1. repo name 2. scala-internals@googlegroups.com, 3. a new passphrase -echo Be careful when using special characters in the passphrase, see http://docs.travis-ci.com/user/encryption-keys/#Note-on-escaping-certain-symbols -cp admin/gpg.sbt project -sbt 'set pgpReadOnly := false' \ - 'set pgpPublicRing := file("admin/pubring.asc")' \ - 'set pgpSecretRing := file("admin/secring.asc")' \ - 'pgp-cmd gen-key' -rm project/gpg.sbt - -echo ============================================================================================ -echo Encrypting admin/secring.asc. Update K and IV variables in admin/build.sh accordingly. -echo ============================================================================================ -travis encrypt-file admin/secring.asc -rm admin/secring.asc -mv secring.asc.enc admin - -echo ============================================================================================ -echo Encrypting environment variables. Add each to a line in .travis.yml. Include a comment -echo with the name of the corresponding variable -echo ============================================================================================ -read -s -p 'PGP_PASSPHRASE: ' PGP_PASSPHRASE -travis encrypt PGP_PASSPHRASE="$PGP_PASSPHRASE" - diff --git a/admin/gpg.sbt b/admin/gpg.sbt deleted file mode 100644 index 3b55e214..00000000 --- a/admin/gpg.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2-1") // only added when publishing, see build.sh diff --git a/admin/publish-settings.sbt b/admin/publish-settings.sbt deleted file mode 100644 index f11b56ad..00000000 --- a/admin/publish-settings.sbt +++ /dev/null @@ -1,9 +0,0 @@ -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") - -Global / credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", env("SONA_USER"), env("SONA_PASS")) diff --git a/admin/pubring.asc b/admin/pubring.asc deleted file mode 100644 index f6c13e89..00000000 --- a/admin/pubring.asc +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: BCPG v1.49 - -mQENBFVQwAoBCACr9atY5vDPbvYEMO8D4OvBz/YTP/tr43S/ibYIL2SAAZXvoVht -5BRAw063HqeM74U58isdbrt33VfmmJSJ0lVJX3iJ6dJeRO66az4aiqUckDP1JyVx -S3PJc402PcnF2Is849DHJF8AutIiAVnXa+gD5j/BShA6UZek9LqM9SRIl0SwE4Xo -WfMGdfvgQFl2vKJohrUbpKIYnhPa4HEu9FUFjVWn4iemeUVZ5OWzfEWNymrWDdLC -q5j1YMfjVvrtT3DhQD+HnDM4l5FNFxl7DHJkeMZZl+pp6RxS++m+/xMK5WmGj2Un -JUKzdoXGJdBA2q3erk5Dq6++ivvLqABt2J8DABEBAAG0O3NjYWxhLXBhcnNlci1j -b21iaW5hdG9ycyA8c2NhbGEtaW50ZXJuYWxzQGdvb2dsZWdyb3Vwcy5jb20+iQEc -BBMBAgAGBQJVUMAKAAoJEHCQr0Ol4Q0LX7MH/1GTgBitKA/RNXK04k//P9U4k7bX -ofJDUrtwx+WNg2bi2er6RQhsWPWQ3p/clgK7by93XkgDrBPLsUTIUTCHGa/Dn9R+ -h5syQfjI5iDi1AZ47ARmSZisadG6RAzLNewQUFcYwBTmGxLBrGBjcxvrmUN1XLml -jA4mqzvApDvwMrzWKdE6eNBf7G2k4dlwG4AzkSNMHfCDFXUgqsqvodrAp+WmGpbN -kZzrAVYoZtfKfalakjZDdn6EqKgw0VgZynSCX1gfwrwLric12fCBWbqXARiMVaM2 -EUqbFszdNRkD/TT9vDIabQqZvLsJO6Ql50hrOJ7IPoEmxJukuS64Je/AYiM= -=iDWo ------END PGP PUBLIC KEY BLOCK----- diff --git a/admin/secring.asc.enc b/admin/secring.asc.enc deleted file mode 100644 index fd45d25625dba57ae0f971e69e32ec50136123d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1888 zcmV-m2cP)+)>NpOwDnBaUCsWMmIJe566=u@+-$PhisfeEhHM2$B+bh@EL&0yT1poc|I{ zS)ebRfc;v|$Em#1upq!rfnu8Au(*|wK+AvEYgwooxJ-Y@mgT|vZs|$XOK~MS&)v&hFu(CH=CmuXjlsZ3XL&`KA=7&*hrebIt>&!7drJC8z^K(8JJ zkN|+W3MNORV>^nX^gp^L#&iKpO(p@BoAOO#k&TTV8y`lus2{M-R2Y?Z`#B6_uJYM6 zHE*F}!h}~w_4XnsJ6sEai6nN>rP<2`6xYG~>bM3{!-=z5Z8obt9W<$zF|LqVzoJ9& zAP4z~5^DQc(-7A6$Z~sVf=AFp`IfFEyGTIlIO;T2{njjFI9cO63%C9wn4(|y`uyMm$Qjvgd%jE!-O zaaQT(+}COX=eMFx21DRDrp595xmdl{i&-UM1kOTRR%?~JpvV>ZN5gox%q8IFd)U&? zMHZsyU)LAwjJ6B(iJdJ10&1z+1MB~OF}y&a?`CAQ4ZT2WpUDrMAr?d%td+`~-?8^z zUf%6iJsV8eG!Aa;&aYHnqG5fH4-=k1*zpoa+rUjgVhPNTjJQ`xlt|7X09+uH5E;gB zQwv3DVC2?0(S{Mqk7Z<_QS|xFhp(Br;C0+PBMFaFbR^Hx1ha#}tpqIE)SqEVT*uXKB->wsKXzQ7 zah^>_2@bpoQX#s%^Mn^pf{C)sK}*DdUxZ!0^p{r#FAs{NR~{o%M$^*k&-rYk zY^k2C#-qyF`C>c^JHgi`Y8>dK7ps+4yd}@Qe{0dy?1<(vSlut5xI5G@RA9{4ZkzEk zdRJ`Tp^+T9M&_u>5@}jJHN?y*=<2AUWnTc9c>|276b*qU#LxRIA_7}ng2pz9IBPu& zFof|=)v9u{_p}GqAU+G;bahvX23@g4zOx*t>6Q)mBsfMxB(drh&Yv)iGz_v^$JuZ@ngC zgVWI}hZke&+O2Tjb5pbk!C-RwnatXT;D|4 z72tE3*q24<|B<{N!<~iFgc`9?@nli}inEKfbp6c1^SW-`F*v({Y>J~67f~w5E3-!G zu;I@azC9ZLJLM?uWxoYBuCcpgw}#LSc^J6KCryZ1Nt^a1cq-0$A8O4brzg*cw<2^| z?kTwV>q;GHJ-4&phqfl70P8NX5FRkL$@xI$PR<$S-mR-sB;Rf?&%$n!Rla7ib$X4P ztG2z-?@U0B*Ut2-iN;(jjdq$|(A#iPuJbenhgFOG?QE4iQnk8flAjU^P9JZ6VSaH> z!|jbzPSZ3GLx_QMcEaH@+$t{Jua1Nsf!qC@HmgO0{(PMsWhO{U_w1Nnfe!MR-yo?i ak)wR%3r_F~Ewj!$!0y^z;?)DNF0T2uSiS@R diff --git a/build.sbt b/build.sbt index 53d301a8..d8c7caf2 100644 --- a/build.sbt +++ b/build.sbt @@ -1,23 +1,28 @@ -import ScalaModulePlugin._ -import sbtcrossproject.crossProject +import sbtcrossproject.CrossPlugin.autoImport.crossProject -crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12", "2.13.0") +lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatform) + .withoutSuffixFor(JVMPlatform).in(file(".")) + .settings(ScalaModulePlugin.scalaModuleSettings) + .jvmSettings(ScalaModulePlugin.scalaModuleSettingsJVM) + .settings( + name := "scala-parser-combinators", -lazy val root = project.in(file(".")) - .aggregate(`scala-parser-combinatorsJS`, `scala-parser-combinatorsJVM`, `scala-parser-combinatorsNative`) - .settings(disablePublishing) + scalaModuleMimaPreviousVersion := Some("1.1.0").filter(_ => System.getenv("SCALAJS_VERSION") != "1.0.0"), + mimaBinaryIssueFilters ++= { + import com.typesafe.tools.mima.core._ + import com.typesafe.tools.mima.core.ProblemFilters._ + Seq( + exclude[IncompatibleSignatureProblem]("*"), -lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform, NativePlatform). - withoutSuffixFor(JVMPlatform).in(file(".")). - settings(scalaModuleSettings: _*). - jvmSettings(scalaModuleSettingsJVM). - settings( - name := "scala-parser-combinators", - version := "1.1.2-SNAPSHOT", - mimaPreviousVersion := Some("1.1.0").filter(_ => System.getenv("SCALAJS_VERSION") != "1.0.0"), + // the following 3 are due to https://github.com/lightbend/mima/issues/388 + exclude[DirectMissingMethodProblem]("scala.util.parsing.json.JSON.numberParser"), + exclude[DirectMissingMethodProblem]("scala.util.parsing.json.JSON.defaultNumberParser"), + exclude[DirectMissingMethodProblem]("scala.util.parsing.json.JSON.keywordCache") + ) + }, apiMappings += (scalaInstance.value.libraryJar -> - url(s"https://www.scala-lang.org/api/${scalaVersion.value}/")), + url(s"https://www.scala-lang.org/api/${scalaVersion.value}/")), scalacOptions in (Compile, doc) ++= Seq( "-diagrams", @@ -38,18 +43,18 @@ lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform, Nati } } } - ). - jvmSettings( + ) + .jvmSettings( OsgiKeys.exportPackage := Seq(s"scala.util.parsing.*;version=${version.value}"), - libraryDependencies += "junit" % "junit" % "4.12" % "test", - libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test" - ). - jsSettings( + libraryDependencies += "junit" % "junit" % "4.13" % Test, + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test + ) + .jsSettings( // Scala.js cannot run forked tests fork in Test := false - ). - jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)). - nativeSettings( + ) + .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)) + .nativeSettings( skip in compile := System.getProperty("java.version").startsWith("1.6") || !scalaVersion.value.startsWith("2.11"), test := {}, libraryDependencies := { @@ -58,7 +63,3 @@ lazy val `scala-parser-combinators` = crossProject(JSPlatform, JVMPlatform, Nati else libraryDependencies.value } ) - -lazy val `scala-parser-combinatorsJVM` = `scala-parser-combinators`.jvm -lazy val `scala-parser-combinatorsJS` = `scala-parser-combinators`.js -lazy val `scala-parser-combinatorsNative` = `scala-parser-combinators`.native diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..96184a0e --- /dev/null +++ b/build.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -e + +# Builds of tagged revisions are published to sonatype staging. + +# 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. + +# sbt-dynver sets the version number from the tag +# sbt-travisci sets the Scala version from the travis job matrix + +# To back-publish an existing release for a new Scala / Scala.js / Scala Native version: +# - check out the tag for the version that needs to be published +# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary +# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g., +# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`) + +# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x +isReleaseJob() { + if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.1[01234]\..*$ ]]; then + true + else + false + fi +} + +if [[ "$SCALAJS_VERSION" != "" ]]; then + projectPrefix="parserCombinatorsJS" +elif [[ "$SCALANATIVE_VERSION" != "" ]]; then + projectPrefix="parserCombinatorsNative" +else + projectPrefix="parserCombinators" +fi + +verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" +tagPat="^v$verPat(#.*)?$" + +if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then + releaseTask="ci-release" + if ! isReleaseJob; then + echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION" + exit 0 + fi +fi + +# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions +export CI_RELEASE="$projectPrefix/publishSigned" +export CI_SNAPSHOT_RELEASE="$projectPrefix/publish" + +# default is sonatypeBundleRelease, which closes and releases the staging repo +# see https://github.com/xerial/sbt-sonatype#commands +# for now, until we're confident in the new release scripts, just close the staging repo. +export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose" + +sbt clean $projectPrefix/test $projectPrefix/publishLocal $releaseTask diff --git a/project/build.properties b/project/build.properties index c0bab049..a919a9b5 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.2.8 +sbt.version=1.3.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index 5c408086..1d7924ab 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,15 +1,13 @@ -addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0") - val scalaJSVersion = - Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.28") - -addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) + Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty).getOrElse("0.6.32") val scalaNativeVersion = Option(System.getenv("SCALANATIVE_VERSION")).filter(_.nonEmpty).getOrElse("0.3.9") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion) +addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.3") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion) -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.0") +addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativeVersion)