Skip to content

Commit a4faa2c

Browse files
authored
Merge pull request #127 from SethTisue/cross-scala-versions
modernize publishing
2 parents a01fea5 + 2213d9f commit a4faa2c

File tree

2 files changed

+25
-34
lines changed

2 files changed

+25
-34
lines changed

build.sbt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
publish / skip := true // root project
2+
13
lazy val scalaTestVersion = "3.2.3"
24

35
lazy val commonSettings = Seq(
4-
crossScalaVersions := Seq("3.0.0-M1", "2.13.3", "2.12.12", "2.11.12"),
5-
scalaVersion := "2.13.3",
66
scalacOptions ++= Seq("-deprecation", "-feature"),
77
)
88

@@ -13,7 +13,7 @@ lazy val swing = project.in(file("."))
1313
.settings(
1414
name := "scala-swing",
1515
OsgiKeys.exportPackage := Seq(s"scala.swing.*;version=${version.value}"),
16-
scalaModuleMimaPreviousVersion := Some("2.1.0"),
16+
// scalaModuleMimaPreviousVersion := Some("2.1.0"), TODO re-enable after we have a 3.0 release
1717
// set the prompt (for this build) to include the project id.
1818
ThisBuild / shellPrompt := { state => Project.extract(state).currentRef.project + "> " },
1919
libraryDependencies ++= Seq(
@@ -38,7 +38,8 @@ lazy val examples = project.in(file("examples"))
3838
.settings(
3939
scalaVersion := (swing / scalaVersion).value,
4040
run / fork := true,
41-
fork := true
41+
fork := true,
42+
publish / skip := true,
4243
)
4344

4445
lazy val uitest = project.in(file("uitest"))
@@ -47,5 +48,6 @@ lazy val uitest = project.in(file("uitest"))
4748
.settings(
4849
scalaVersion := (swing / scalaVersion).value,
4950
run / fork := true,
50-
fork := true
51+
fork := true,
52+
publish / skip := true,
5153
)

build.sh

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ set -e
1010
# sbt-dynver sets the version number from the tag
1111
# sbt-travisci sets the Scala version from the travis job matrix
1212

13-
# When a new binary incompatible Scala version becomes available, a previously released version
14-
# can be released using that new Scala version by creating a new tag containing the Scala version
15-
# after a hash, e.g., v1.2.3#2.13.0-M3.
13+
# To back-publish an existing release for a new Scala / Scala.js / Scala Native version:
14+
# - check out the tag for the version that needs to be published
15+
# - change `.travis.yml` to adjust the version numbers and trim down the build matrix as necessary
16+
# - commit the changes and tag this new revision with an arbitrary suffix after a hash, e.g.,
17+
# `v1.2.3#dotty-0.27` (the suffix is ignored, the version will be `1.2.3`)
1618

17-
# For normal tags that are cross-built, we release on JDK 8 for Scala 2.x
19+
# We release on JDK 8 (for Scala 2.x and 3.x)
1820
isReleaseJob() {
1921
if [[ "$ADOPTOPENJDK" == "8" ]]; then
2022
true
@@ -23,43 +25,30 @@ isReleaseJob() {
2325
fi
2426
}
2527

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

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

3837
if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then
3938
releaseTask="ci-release"
40-
tagScalaVer=$(echo $TRAVIS_TAG | sed s/[^#]*// | sed s/^#//)
41-
if [[ "$tagScalaVer" == "" ]]; then
42-
if ! isReleaseJob; then
43-
echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION"
44-
exit 0
45-
fi
46-
else
47-
if isTagScalaReleaseJob; then
48-
setTagScalaVersion='set every scalaVersion := "'$tagScalaVer'"'
49-
else
50-
echo "The releases for Scala $tagScalaVer are built by other jobs in the travis job matrix"
51-
exit 0
52-
fi
39+
if ! isReleaseJob; then
40+
echo "Not releasing on Java $ADOPTOPENJDK with Scala $TRAVIS_SCALA_VERSION"
41+
exit 0
5342
fi
5443
fi
5544

5645
# default is +publishSigned; we cross-build with travis jobs, not sbt's crossScalaVersions
57-
export CI_RELEASE="publishSigned"
58-
export CI_SNAPSHOT_RELEASE="publish"
46+
export CI_RELEASE="${projectPrefix}publishSigned"
47+
export CI_SNAPSHOT_RELEASE="${projectPrefix}publish"
5948

6049
# default is sonatypeBundleRelease, which closes and releases the staging repo
6150
# see https://github.com/xerial/sbt-sonatype#commands
6251
# for now, until we're confident in the new release scripts, just close the staging repo.
6352
export CI_SONATYPE_RELEASE="; sonatypePrepare; sonatypeBundleUpload; sonatypeClose"
6453

65-
sbt "$setTagScalaVersion" clean test publishLocal $releaseTask
54+
sbt clean ${projectPrefix}test ${projectPrefix}publishLocal $releaseTask

0 commit comments

Comments
 (0)