Skip to content

Commit ed544b5

Browse files
authored
Update build settings to use latest version of sbt and plugins (#552)
1 parent 2cb3f6d commit ed544b5

File tree

7 files changed

+46
-39
lines changed

7 files changed

+46
-39
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ lib
1212
.idea
1313
atlassian-ide-plugin.xml
1414
.idea/copyright/msgpack.xml
15+
.bsp

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ Here is a list of sbt commands for daily development:
8888
8989
> release # Run the release procedure (set a new version, run tests, upload artifacts, then deploy to Sonatype)
9090
91-
# If you need to perform the individual release steps manually, use the following commands:
91+
# [optional] When you need to perform the individual release steps manually, use the following commands:
9292
> publishSigned # Publish GPG signed artifacts to the Sonatype repository
93-
> sonatypeRelease # Publish to the Maven Central (It will be synched within less than 4 hours)
93+
> sonatypeBundleRelease # Publish to the Maven Central (It will be synched within less than 4 hours)
9494
```
9595

9696
For publishing to Maven central, msgpack-java uses [sbt-sonatype](https://github.com/xerial/sbt-sonatype) plugin. Set Sonatype account information (user name and password) in the global sbt settings. To protect your password, never include this file in your project.

build.sbt

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
import ReleaseTransformations._
22

3+
Global / onChangedBuildSource := ReloadOnSourceChanges
4+
5+
// For performance testing, ensure each test run one-by-one
6+
Global / concurrentRestrictions := Seq(
7+
Tags.limit(Tags.Test, 1)
8+
)
9+
310
val buildSettings = Seq[Setting[_]](
411
organization := "org.msgpack",
512
organizationName := "MessagePack",
613
organizationHomepage := Some(new URL("http://msgpack.org/")),
714
description := "MessagePack for Java",
8-
scalaVersion := "2.12.8",
9-
logBuffered in Test := false,
15+
scalaVersion := "2.12.13",
16+
Test / logBuffered := false,
1017
// msgpack-java should be a pure-java library, so remove Scala specific configurations
1118
autoScalaLibrary := false,
1219
crossPaths := false,
13-
// For performance testing, ensure each test run one-by-one
14-
concurrentRestrictions in Global := Seq(
15-
Tags.limit(Tags.Test, 1)
16-
),
1720
// JVM options for building
1821
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-feature"),
19-
javaOptions in Test ++= Seq("-ea"),
22+
Test / javaOptions ++= Seq("-ea"),
2023
javacOptions ++= Seq("-source", "1.7", "-target", "1.7"),
21-
javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation"),
24+
Compile / compile / javacOptions ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation"),
2225
// Use lenient validation mode when generating Javadoc (for Java8)
23-
javacOptions in doc := {
26+
doc / javacOptions := {
2427
val opts = Seq("-source", "1.7")
2528
if (scala.util.Properties.isJavaAtLeast("1.8")) {
2629
opts ++ Seq("-Xdoclint:none")
@@ -29,7 +32,7 @@ val buildSettings = Seq[Setting[_]](
2932
}
3033
},
3134
// Release settings
32-
releaseTagName := { (version in ThisBuild).value },
35+
releaseTagName := { (ThisBuild / version).value },
3336
releaseProcess := Seq[ReleaseStep](
3437
checkSnapshotDependencies,
3538
inquireVersions,
@@ -39,26 +42,21 @@ val buildSettings = Seq[Setting[_]](
3942
commitReleaseVersion,
4043
tagRelease,
4144
releaseStepCommand("publishSigned"),
45+
releaseStepCommand("sonatypeBundleRelease"),
4246
setNextVersion,
4347
commitNextVersion,
44-
releaseStepCommand("sonatypeReleaseAll"),
4548
pushChanges
4649
),
4750
// Add sonatype repository settings
48-
publishTo := Some(
49-
if (isSnapshot.value)
50-
Opts.resolver.sonatypeSnapshots
51-
else
52-
Opts.resolver.sonatypeStaging
53-
),
51+
publishTo := sonatypePublishToBundle.value,
5452
// Find bugs
5553
findbugsReportType := Some(FindbugsReport.FancyHtml),
5654
findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html"),
5755
// Style check config: (sbt-jchekcstyle)
5856
jcheckStyleConfig := "facebook",
5957
// Run jcheckstyle both for main and test codes
60-
(compile in Compile) := ((compile in Compile) dependsOn (jcheckStyle in Compile)).value,
61-
(compile in Test) := ((compile in Test) dependsOn (jcheckStyle in Test)).value
58+
Compile / compile := ((Compile / compile) dependsOn (Compile / jcheckStyle)).value,
59+
Test / compile := ((Test / compile) dependsOn (Test / jcheckStyle)).value
6260
)
6361

6462
val junitInterface = "com.novocode" % "junit-interface" % "0.11" % "test"

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sbt.version=1.2.8
1+
sbt.version=1.5.2
22

project/plugins.sbt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.11")
2-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.5")
3-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
4-
addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
5-
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.0.3")
6-
addSbtPlugin("org.xerial.sbt" % "sbt-jcheckstyle" % "0.2.1")
7-
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5")
8-
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3")
9-
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")
1+
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.0.15")
2+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
3+
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
4+
addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
5+
// TODO: Fixes jacoco error:
6+
// java.lang.NoClassDefFoundError: Could not initialize class org.jacoco.core.internal.flow.ClassProbesAdapter
7+
//addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.3.0")
8+
addSbtPlugin("org.xerial.sbt" % "sbt-jcheckstyle" % "0.2.1")
9+
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5")
10+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
1011

1112
scalacOptions ++= Seq("-deprecation", "-feature")

sbt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434

3535
set -o pipefail
3636

37-
declare -r sbt_release_version="1.3.13"
38-
declare -r sbt_unreleased_version="1.4.0-M1"
37+
declare -r sbt_release_version="1.5.1"
38+
declare -r sbt_unreleased_version="1.5.1"
3939

40-
declare -r latest_213="2.13.3"
41-
declare -r latest_212="2.12.12"
40+
declare -r latest_213="2.13.5"
41+
declare -r latest_212="2.12.13"
4242
declare -r latest_211="2.11.12"
4343
declare -r latest_210="2.10.7"
4444
declare -r latest_29="2.9.3"
@@ -48,7 +48,7 @@ declare -r buildProps="project/build.properties"
4848

4949
declare -r sbt_launch_ivy_release_repo="https://repo.typesafe.com/typesafe/ivy-releases"
5050
declare -r sbt_launch_ivy_snapshot_repo="https://repo.scala-sbt.org/scalasbt/ivy-snapshots"
51-
declare -r sbt_launch_mvn_release_repo="https://repo.scala-sbt.org/scalasbt/maven-releases"
51+
declare -r sbt_launch_mvn_release_repo="https://repo1.maven.org/maven2"
5252
declare -r sbt_launch_mvn_snapshot_repo="https://repo.scala-sbt.org/scalasbt/maven-snapshots"
5353

5454
declare -r default_jvm_opts_common="-Xms512m -Xss2m -XX:MaxInlineLevel=18"
@@ -247,11 +247,18 @@ java_version() {
247247
echo "$version"
248248
}
249249

250+
is_apple_silicon() { [[ "$(uname -s)" == "Darwin" && "$(uname -m)" == "arm64" ]]; }
251+
250252
# MaxPermSize critical on pre-8 JVMs but incurs noisy warning on 8+
251253
default_jvm_opts() {
252254
local -r v="$(java_version)"
253255
if [[ $v -ge 10 ]]; then
254-
echo "$default_jvm_opts_common -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
256+
if is_apple_silicon; then
257+
# As of Dec 2020, JVM for Apple Silicon (M1) doesn't support JVMCI
258+
echo "$default_jvm_opts_common"
259+
else
260+
echo "$default_jvm_opts_common -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
261+
fi
255262
elif [[ $v -ge 8 ]]; then
256263
echo "$default_jvm_opts_common"
257264
else
@@ -471,7 +478,7 @@ process_args() {
471478
-trace) require_arg integer "$1" "$2" && trace_level="$2" && shift 2 ;;
472479
-debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;;
473480

474-
-no-colors) addJava "-Dsbt.log.noformat=true" && shift ;;
481+
-no-colors) addJava "-Dsbt.log.noformat=true" && addJava "-Dsbt.color=false" && shift ;;
475482
-sbt-create) sbt_create=true && shift ;;
476483
-sbt-dir) require_arg path "$1" "$2" && sbt_dir="$2" && shift 2 ;;
477484
-sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;;

version.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version in ThisBuild := "0.8.23-SNAPSHOT"
1+
ThisBuild / version := "0.8.23-SNAPSHOT"

0 commit comments

Comments
 (0)