Skip to content
This repository has been archived by the owner on Jun 23, 2020. It is now read-only.

Commit

Permalink
New scala-module-plugin with sbt-ci-release / travisci / dynver / header
Browse files Browse the repository at this point in the history
  • Loading branch information
lrytz committed Sep 20, 2019
1 parent a9749eb commit e014ebf
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 245 deletions.
44 changes: 32 additions & 12 deletions .travis.yml
@@ -1,22 +1,42 @@
language: scala

scala:
- 2.11.12
- 2.12.8
- 2.12.9
- 2.12.10

env:
global:
# PGP_PASSPHRASE
- secure: "ImY9KGs8EmTk1mPgZJEWqfy0GR7Wp2lZ07z1eSVwMQTGvYZIPZchNa30jzjB4YVHrG5PvwOSXaGx3ivFRZk/FElWbJ1skFXfHz+JwvNRvN6fhNIhoD0mkPWDTDtA3NnlLen4hbC9rZCPuP4RqrS1jy2nZuD36ZLx2NU9tQM6tUc="
# SONA_USER
- secure: "f0Acd/hWkgHoT5uyFL+K3D8DB2bRSoXRJhnTueMzJvTHBJZd2kpPo9t7YsmH7fowopVMCcBPzfRyiPoJVf4CJKc/SHCKn/YMJInCC1YPOrchLX/ShTPTeaP4lxFnm/bmmdPOmqfLSQsPIuEP6LBffsq1lvLO6VL61QrDy+D4EQs="
# SONA_PASS
- secure: "E6OE1MoZ4VQHRNtEyyKfmnj8Bj7uGpgHLmlvJR/iy7qdxBbNA8cEz/Qs64uTft5zfZ9bJsQhiuxLcTtFKYKFP4qvExz8FyilhmUwKjD5Eux4FAeBjDBeXBETM1JYFB+JYP9l8dcQecMeGpd46I52pLjYYmNyQQ1YpOvK29GIQLA="
- ADOPTOPENJDK=8
- ADOPTOPENJDK=11

before_install:
# adding $HOME/.sdkman to cache would create an empty directory, which interferes with the initial installation
- "[[ -d $HOME/.sdkman/bin ]] || rm -rf $HOME/.sdkman/"
- curl -sL https://get.sdkman.io | bash
- echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
- source "$HOME/.sdkman/bin/sdkman-init.sh"

script:
- admin/build.sh
install:
- sdk install java $(sdk list java | grep -o "$ADOPTOPENJDK\.[0-9\.]*hs-adpt" | head -1)
- unset JAVA_HOME
- java -Xmx32m -version
- git fetch --tags # get all tags for sbt-dynver

jdk:
- openjdk8
- openjdk11
script: ./build.sh

notifications:
email:
- adriaan.moors@lightbend.com
- seth.tisue@lightbend.com

before_cache:
- rm -f $HOME/.ivy2/.sbt.ivy.lock
- find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm
- find $HOME/.sbt -name "*.lock" | xargs rm
cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt
- $HOME/.cache/coursier
- $HOME/.sdkman
72 changes: 0 additions & 72 deletions admin/README.md

This file was deleted.

53 changes: 0 additions & 53 deletions admin/build.sh

This file was deleted.

11 changes: 0 additions & 11 deletions admin/encryptEnvVars.sh

This file was deleted.

41 changes: 0 additions & 41 deletions admin/genKeyPair.sh

This file was deleted.

2 changes: 0 additions & 2 deletions admin/gpg.sbt

This file was deleted.

9 changes: 0 additions & 9 deletions admin/publish-settings.sbt

This file was deleted.

18 changes: 0 additions & 18 deletions admin/pubring.asc

This file was deleted.

Binary file removed admin/secring.asc.enc
Binary file not shown.
35 changes: 10 additions & 25 deletions build.sbt
@@ -1,27 +1,12 @@
import Keys.{ `package` => packageTask }
import ScalaModulePlugin._

// plugin logic of build based on https://github.com/retronym/boxer

scalaVersionsByJvm in ThisBuild := {
val vs = List("2.11.12", "2.12.8")
// Map[JvmVersion, List[(ScalaVersion, UseForPublishing)]]
Map(
8 -> vs.map(_ -> true),
11 -> vs.map(_ -> false),
12 -> vs.map(_ -> false)
)
}

lazy val commonSettings = scalaModuleSettings ++ Seq(
repoName := "scala-continuations",
organization := "org.scala-lang.plugins",
version := "1.0.3-SNAPSHOT",

scalacOptions ++= Seq(
"-deprecation",
"-feature")
) ++ crossVersionSharedSources
lazy val commonSettings = ScalaModulePlugin.scalaModuleSettings ++
ScalaModulePlugin.scalaModuleSettingsJVM ++
Seq(
scalaModuleRepoName := "scala-continuations",
organization := "org.scala-lang.plugins",
scalacOptions ++= Seq("-deprecation", "-feature")
) ++ crossVersionSharedSources

lazy val crossVersionSharedSources: Seq[Setting[_]] =
Seq(Compile, Test).map { sc =>
Expand All @@ -35,9 +20,9 @@ lazy val crossVersionSharedSources: Seq[Setting[_]] =
}
}

lazy val root = project.in(file("."))
lazy val continuations = project.in(file("."))
.settings(commonSettings: _*)
.settings(publishArtifact := false)
.settings(skip in publish := true)
.aggregate(plugin, library)

lazy val plugin = project
Expand All @@ -56,7 +41,7 @@ lazy val library = project
.settings(commonSettings: _*)
.settings(
name := "scala-continuations-library",
mimaPreviousVersion := Some("1.0.3"),
scalaModuleMimaPreviousVersion := Some("1.0.3"),

scalacOptions ++= Seq(
// add the plugin to the compiler
Expand Down
67 changes: 67 additions & 0 deletions build.sh
@@ -0,0 +1,67 @@
#!/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

# 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 version
# after a hash, e.g., v1.2.3#2.13.0-M3. In this situation, the first job of the travis job
# matrix builds the release. All other jobs are stopped. Make sure that the first job uses
# the desired JVM version.

# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x
isReleaseJob() {
if [[ "$ADOPTOPENJDK" == "8" ]]; then
true
else
false
fi
}

# For tags that define a Scala version, we pick the jobs of one Scala version (2.13.x) to do the releases
isTagScalaReleaseJob() {
if [[ "$ADOPTOPENJDK" == "8" && "$TRAVIS_SCALA_VERSION" =~ ^2\.13\.[0-9]+$ ]]; then
true
else
false
fi
}

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

if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
releaseTask="ci-release"
tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//)
if [[ "$tagScalaVer" == "" ]]; then
if ! isReleaseJob; then
echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION"
exit 0
fi
else
if isTagScalaReleaseJob; then
setTagScalaVersion='set every scalaVersion := "'$tagScalaVer'"'
else
echo "The releases for Scala $tagScalaVer are built by other jobs in the travis job matrix"
exit 0
fi
fi
fi
# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions
export CI_RELEASE="publishSigned"
export CI_SNAPSHOT_RELEASE="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 "$setTagScalaVersion" clean test publishLocal $releaseTask
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version=1.2.8
sbt.version=1.3.0
2 changes: 1 addition & 1 deletion project/plugins.sbt
@@ -1 +1 @@
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.2")

0 comments on commit e014ebf

Please sign in to comment.