Skip to content

New scala-module-plugin with sbt-ci-release / travisci / dynver / header #112

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 1 commit into from
Sep 20, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
44 changes: 31 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
dist: trusty

language: scala

scala:
- 2.11.12
- 2.12.10
- 2.13.1

env:
global:
# PGP_PASSPHRASE
- secure: "MIHv2s6njtXubCzbP/eYXszuO/Y3FADYATZpDtOULZmQHcQ8z+sccQHidyq6hvoK9/I2hRUrc5RIelfA7D32tqP7aF3P9Dq1ZdiWqZYmFKUl6wzJMhgWwnT1RA9Nu67PcNLZGwOe7+55zZpWVNbeTKMe05TzUaaGUgApr9wvS0I="
# SONA_USER
- secure: "e3FEhT76+qpmeubxtthmubnuyf5faCZneB1lQE8zv89/NZrD+v6tM8hGWatfiyyswmcaUdukxW/Q3NVlesKiy+cJLgNJ8AImRckKPiPVUYpXcQoc0R1Nyl4DeDyorGE17SslW28frlRU9OutTnZQlOfg4uqCdZuuCdcPV0lnGAU="
# SONA_PASS
- secure: "BLhtiCjcjvwB0lUvfrMa9CSvWDcdGkadAVFFPyuXSU2OQw/RR9dZF3/ZLILf9jHL3pWj/Scp8jWRl40y6sUxihUOXhhxpDCF8UVgnXdDCQf/W7gerRC/+3Zpr3LugVeSEuBgECld6XZnYNst/xbL9GHzEc7kDm7MIfz8nY8Ic7s="
- ADOPTOPENJDK=8
- ADOPTOPENJDK=11

script: admin/build.sh
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"

jdk:
- oraclejdk8
- openjdk11
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

script: ./build.sh

notifications:
email:
- [email protected]
- [email protected]
- [email protected]

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.

1 change: 0 additions & 1 deletion 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.
43 changes: 8 additions & 35 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,40 +1,13 @@
import ScalaModulePlugin._

scalaModuleSettings

name := "scala-swing"

version := "2.1.1"

scalacOptions in ThisBuild ++= Seq("-deprecation", "-feature")

// Map[JvmMajorVersion, List[(ScalaVersion, UseForPublishing)]]
scalaVersionsByJvm in ThisBuild := Map(
8 -> List("2.11.12", "2.12.8", "2.13.0").map(_ -> true),
9 -> List("2.11.12", "2.12.8", "2.13.0").map(_ -> false),
10 -> List("2.11.12", "2.12.8", "2.13.0").map(_ -> false),
11 -> List("2.11.12", "2.12.8", "2.13.0").map(_ -> false),
12 -> List("2.11.12", "2.12.8", "2.13.0").map(_ -> false)
)

scalaVersion in ThisBuild := "2.12.8"

OsgiKeys.exportPackage := Seq(s"scala.swing.*;version=${version.value}")

mimaPreviousVersion := Some("2.1.0")

// set the prompt (for this build) to include the project id.
shellPrompt in ThisBuild := { state => Project.extract(state).currentRef.project + "> " }

lazy val swing = project.in(file("."))
.settings(ScalaModulePlugin.scalaModuleSettings)
.settings(ScalaModulePlugin.scalaModuleSettingsJVM)
.settings(
libraryDependencies += {
if (scalaVersion.value == "2.13.0") {
"org.scalatest" % "scalatest_2.13.0-RC3" % "3.0.8-RC5" % Test
} else {
"org.scalatest" %% "scalatest" % "3.0.8-RC5" % Test
}
},
name := "scala-swing",
OsgiKeys.exportPackage := Seq(s"scala.swing.*;version=${version.value}"),
scalaModuleMimaPreviousVersion := Some("2.1.0"),
// set the prompt (for this build) to include the project id.
shellPrompt in ThisBuild := { state => Project.extract(state).currentRef.project + "> " },
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.8" % Test,
// Adds a `src/main/scala-2.13+` source directory for Scala 2.13 and newer
// and a `src/main/scala-2.13-` source directory for Scala version older than 2.13
unmanagedSourceDirectories in Compile += {
Expand Down
67 changes: 67 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.2.8
sbt.version=1.3.0
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.0.0")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "2.1.2")