Skip to content

Commit eddb753

Browse files
authored
Merge pull request msgpack#443 from msgpack/sbt104
Upgrade to sbt-1.0.4
2 parents d58e00c + 84666b6 commit eddb753

22 files changed

+823
-804
lines changed

.scalafmt.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
maxColumn = 180
2+
style = defaultWithAlign
3+
optIn.breaksInsideChains = true

.travis.yml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@ cache:
55
- $HOME/.m2/repository/
66
- $HOME/.ivy2/cache/
77
- $HOME/.sbt/boot/
8+
- $HOME/.coursier
89

910
sudo: false
1011

11-
jdk:
12-
- openjdk7
13-
- oraclejdk8
14-
1512
branches:
1613
only:
1714
- develop
1815

19-
script:
20-
- ./sbt jcheckStyle
21-
- ./sbt test
22-
- ./sbt test -J-Dmsgpack.universal-buffer=true
23-
2416
matrix:
2517
include:
26-
- dist: trusty
18+
- env: PROJECT=checkstyle
19+
jdk: oraclejdk8
20+
script:
21+
- ./sbt jcheckStyle
22+
- env: PROJECT=java8
23+
jdk: oraclejdk8
24+
script:
25+
- ./sbt test
26+
- ./sbt test -J-Dmsgpack.universal-buffer=true
27+
- env: PROJECT=java9
28+
dist: trusty
2729
group: edge
2830
sudo: required
2931
jdk: oraclejdk9
@@ -32,16 +34,5 @@ matrix:
3234
packages:
3335
- oracle-java9-installer
3436
script:
35-
# https://github.com/sbt/sbt/pull/2951
36-
- git clone https://github.com/retronym/java9-rt-export
37-
- cd java9-rt-export/
38-
- git checkout 1019a2873d057dd7214f4135e84283695728395d
39-
- echo "sbt.version=1.0.2" > project/build.properties
40-
- sbt package
41-
- mkdir -p $HOME/.sbt/0.13/java9-rt-ext; java -jar target/java9-rt-export-*.jar $HOME/.sbt/0.13/java9-rt-ext/rt.jar
42-
- jar tf $HOME/.sbt/0.13/java9-rt-ext/rt.jar | grep java/lang/Object
43-
- cd ..
44-
- rm sbt
45-
- wget https://raw.githubusercontent.com/paulp/sbt-extras/3ba0e52f32d32c0454ec3a926caae2db0caaca12/sbt && chmod +x ./sbt
46-
- ./sbt -Dscala.ext.dirs=$HOME/.sbt/0.13/java9-rt-ext test
47-
- ./sbt -Dscala.ext.dirs=$HOME/.sbt/0.13/java9-rt-ext -Dmsgpack.universal-buffer=true test
37+
- ./sbt test
38+
- ./sbt test -J-Dmsgpack.universal-buffer=true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Here is a list of sbt commands for daily development:
7474
> findbugs # Produce findbugs report in target/findbugs
7575
> jacoco:cover # Report the code coverage of tests to target/jacoco folder
7676
> jcheckStyle # Run check style
77+
> scalafmt # Reformat Scala codes
7778
```
7879

7980
### Publishing

build.sbt

Lines changed: 76 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,53 @@
1-
import de.johoop.findbugs4sbt.ReportType
21
import ReleaseTransformations._
32

4-
val buildSettings = findbugsSettings ++ jacoco.settings ++ osgiSettings ++ Seq[Setting[_]](
3+
val buildSettings = Seq[Setting[_]](
54
organization := "org.msgpack",
65
organizationName := "MessagePack",
76
organizationHomepage := Some(new URL("http://msgpack.org/")),
87
description := "MessagePack for Java",
9-
scalaVersion := "2.11.11",
8+
scalaVersion := "2.12.4",
109
logBuffered in Test := false,
10+
// msgpack-java should be a pure-java library, so remove Scala specific configurations
1111
autoScalaLibrary := false,
1212
crossPaths := false,
1313
// For performance testing, ensure each test run one-by-one
1414
concurrentRestrictions in Global := Seq(
1515
Tags.limit(Tags.Test, 1)
1616
),
1717
// JVM options for building
18-
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-target:jvm-1.6", "-feature"),
18+
scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked", "-target:jvm-1.7", "-feature"),
1919
javaOptions in Test ++= Seq("-ea"),
20-
javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.6", "-target", "1.6"),
20+
javacOptions in (Compile, compile) ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation", "-source", "1.7", "-target", "1.7"),
2121
// Use lenient validation mode when generating Javadoc (for Java8)
2222
javacOptions in doc := {
23-
val opts = Seq("-source", "1.6")
23+
val opts = Seq("-source", "1.7")
2424
if (scala.util.Properties.isJavaAtLeast("1.8")) {
2525
opts ++ Seq("-Xdoclint:none")
26-
}
27-
else {
26+
} else {
2827
opts
2928
}
3029
},
3130
// Release settings
3231
releaseTagName := { (version in ThisBuild).value },
3332
releaseProcess := Seq[ReleaseStep](
34-
checkSnapshotDependencies,
35-
inquireVersions,
36-
runClean,
37-
runTest,
38-
setReleaseVersion,
39-
commitReleaseVersion,
40-
tagRelease,
41-
ReleaseStep(action = Command.process("publishSigned", _)),
42-
setNextVersion,
43-
commitNextVersion,
44-
ReleaseStep(action = Command.process("sonatypeReleaseAll", _)),
45-
pushChanges
46-
),
47-
48-
// Jacoco code coverage report
49-
parallelExecution in jacoco.Config := false,
50-
33+
checkSnapshotDependencies,
34+
inquireVersions,
35+
runClean,
36+
runTest,
37+
setReleaseVersion,
38+
commitReleaseVersion,
39+
tagRelease,
40+
releaseStepCommand("publishSigned"),
41+
setNextVersion,
42+
commitNextVersion,
43+
releaseStepCommand("sonatypeReleaseAll"),
44+
pushChanges
45+
),
5146
// Find bugs
52-
findbugsReportType := Some(ReportType.FancyHtml),
47+
findbugsReportType := Some(FindbugsReport.FancyHtml),
5348
findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html"),
54-
5549
// Style check config: (sbt-jchekcstyle)
5650
jcheckStyleConfig := "facebook",
57-
5851
// Run jcheckstyle both for main and test codes
5952
(compile in Compile) := ((compile in Compile) dependsOn (jcheckStyle in Compile)).value,
6053
(compile in Test) := ((compile in Test) dependsOn (jcheckStyle in Test)).value
@@ -64,57 +57,61 @@ val junitInterface = "com.novocode" % "junit-interface" % "0.11" % "test"
6457

6558
// Project settings
6659
lazy val root = Project(id = "msgpack-java", base = file("."))
67-
.settings(
68-
buildSettings,
69-
// Do not publish the root project
70-
publishArtifact := false,
71-
publish := {},
72-
publishLocal := {},
73-
findbugs := {
74-
// do not run findbugs for the root project
75-
}
76-
).aggregate(msgpackCore, msgpackJackson)
60+
.settings(
61+
buildSettings,
62+
// Do not publish the root project
63+
publishArtifact := false,
64+
publish := {},
65+
publishLocal := {},
66+
findbugs := {
67+
// do not run findbugs for the root project
68+
}
69+
)
70+
.aggregate(msgpackCore, msgpackJackson)
7771

7872
lazy val msgpackCore = Project(id = "msgpack-core", base = file("msgpack-core"))
79-
.settings(
80-
buildSettings,
81-
description := "Core library of the MessagePack for Java",
82-
OsgiKeys.bundleSymbolicName := "org.msgpack.msgpack-core",
83-
OsgiKeys.exportPackage := Seq(
84-
// TODO enumerate used packages automatically
85-
"org.msgpack.core",
86-
"org.msgpack.core.annotations",
87-
"org.msgpack.core.buffer",
88-
"org.msgpack.value",
89-
"org.msgpack.value.impl"
90-
),
91-
libraryDependencies ++= Seq(
92-
// msgpack-core should have no external dependencies
93-
junitInterface,
94-
"org.scalatest" %% "scalatest" % "3.0.3" % "test",
95-
"org.scalacheck" %% "scalacheck" % "1.13.5" % "test",
96-
"org.xerial" %% "xerial-core" % "3.6.0" % "test",
97-
"org.msgpack" % "msgpack" % "0.6.12" % "test",
98-
"commons-codec" % "commons-codec" % "1.10" % "test",
99-
"com.typesafe.akka" %% "akka-actor" % "2.3.16" % "test"
100-
)
101-
)
102-
103-
lazy val msgpackJackson = Project(id = "msgpack-jackson", base = file("msgpack-jackson"))
104-
.settings(
105-
buildSettings,
106-
name := "jackson-dataformat-msgpack",
107-
description := "Jackson extension that adds support for MessagePack",
108-
OsgiKeys.bundleSymbolicName := "org.msgpack.msgpack-jackson",
109-
OsgiKeys.exportPackage := Seq(
110-
"org.msgpack.jackson",
111-
"org.msgpack.jackson.dataformat"
112-
),
113-
libraryDependencies ++= Seq(
114-
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.1",
115-
junitInterface,
116-
"org.apache.commons" % "commons-math3" % "3.6.1" % "test"
117-
),
118-
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v")
119-
).dependsOn(msgpackCore)
73+
.enablePlugins(SbtOsgi)
74+
.settings(
75+
buildSettings,
76+
description := "Core library of the MessagePack for Java",
77+
OsgiKeys.bundleSymbolicName := "org.msgpack.msgpack-core",
78+
OsgiKeys.exportPackage := Seq(
79+
// TODO enumerate used packages automatically
80+
"org.msgpack.core",
81+
"org.msgpack.core.annotations",
82+
"org.msgpack.core.buffer",
83+
"org.msgpack.value",
84+
"org.msgpack.value.impl"
85+
),
86+
libraryDependencies ++= Seq(
87+
// msgpack-core should have no external dependencies
88+
junitInterface,
89+
"org.scalatest" %% "scalatest" % "3.0.3" % "test",
90+
"org.scalacheck" %% "scalacheck" % "1.13.5" % "test",
91+
"org.xerial" %% "xerial-core" % "3.6.0" % "test",
92+
"org.msgpack" % "msgpack" % "0.6.12" % "test",
93+
"commons-codec" % "commons-codec" % "1.10" % "test",
94+
"com.typesafe.akka" %% "akka-actor" % "2.5.7" % "test"
95+
)
96+
)
12097

98+
lazy val msgpackJackson =
99+
Project(id = "msgpack-jackson", base = file("msgpack-jackson"))
100+
.enablePlugins(SbtOsgi)
101+
.settings(
102+
buildSettings,
103+
name := "jackson-dataformat-msgpack",
104+
description := "Jackson extension that adds support for MessagePack",
105+
OsgiKeys.bundleSymbolicName := "org.msgpack.msgpack-jackson",
106+
OsgiKeys.exportPackage := Seq(
107+
"org.msgpack.jackson",
108+
"org.msgpack.jackson.dataformat"
109+
),
110+
libraryDependencies ++= Seq(
111+
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.1",
112+
junitInterface,
113+
"org.apache.commons" % "commons-math3" % "3.6.1" % "test"
114+
),
115+
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v")
116+
)
117+
.dependsOn(msgpackCore)

msgpack-core/src/test/scala/org/msgpack/core/MessageBufferPackerTest.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,11 @@ class MessageBufferPackerTest extends MessagePackSpec {
2323
"MessageBufferPacker" should {
2424
"be equivalent to ByteArrayOutputStream" in {
2525
val packer1 = MessagePack.newDefaultBufferPacker
26-
packer1.packValue(newMap(
27-
newString("a"), newInteger(1),
28-
newString("b"), newString("s")))
26+
packer1.packValue(newMap(newString("a"), newInteger(1), newString("b"), newString("s")))
2927

30-
val stream = new ByteArrayOutputStream
28+
val stream = new ByteArrayOutputStream
3129
val packer2 = MessagePack.newDefaultPacker(stream)
32-
packer2.packValue(newMap(
33-
newString("a"), newInteger(1),
34-
newString("b"), newString("s")))
30+
packer2.packValue(newMap(newString("a"), newInteger(1), newString("b"), newString("s")))
3531
packer2.flush
3632

3733
packer1.toByteArray shouldBe stream.toByteArray

msgpack-core/src/test/scala/org/msgpack/core/MessageFormatTest.scala

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ import org.scalatest.exceptions.TestFailedException
2222
import scala.util.Random
2323

2424
/**
25-
* Created on 2014/05/07.
26-
*/
27-
class MessageFormatTest
28-
extends MessagePackSpec {
25+
* Created on 2014/05/07.
26+
*/
27+
class MessageFormatTest extends MessagePackSpec {
2928
"MessageFormat" should {
3029
"cover all byte codes" in {
3130
def checkV(b: Byte, tpe: ValueType) {
32-
try
33-
MessageFormat.valueOf(b).getValueType shouldBe tpe
31+
try MessageFormat.valueOf(b).getValueType shouldBe tpe
3432
catch {
3533
case e: TestFailedException =>
3634
error(f"Failure when looking at byte ${b}%02x")
@@ -80,7 +78,6 @@ class MessageFormatTest
8078
check(Code.EXT16, ValueType.EXTENSION, MessageFormat.EXT16)
8179
check(Code.EXT32, ValueType.EXTENSION, MessageFormat.EXT32)
8280

83-
8481
check(Code.INT8, ValueType.INTEGER, MessageFormat.INT8)
8582
check(Code.INT16, ValueType.INTEGER, MessageFormat.INT16)
8683
check(Code.INT32, ValueType.INTEGER, MessageFormat.INT32)
@@ -94,7 +91,6 @@ class MessageFormatTest
9491
check(Code.STR16, ValueType.STRING, MessageFormat.STR16)
9592
check(Code.STR32, ValueType.STRING, MessageFormat.STR32)
9693

97-
9894
check(Code.FLOAT32, ValueType.FLOAT, MessageFormat.FLOAT32)
9995
check(Code.FLOAT64, ValueType.FLOAT, MessageFormat.FLOAT64)
10096

@@ -107,7 +103,7 @@ class MessageFormatTest
107103
}
108104

109105
"improve the valueOf performance" in {
110-
val N = 1000000
106+
val N = 1000000
111107
val idx = (0 until N).map(x => Random.nextInt(256).toByte).toArray[Byte]
112108

113109
// Initialize

msgpack-core/src/test/scala/org/msgpack/core/MessagePackSpec.scala

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,22 @@ import xerial.core.util.{TimeReport, Timer}
2424

2525
import scala.language.implicitConversions
2626

27-
trait MessagePackSpec
28-
extends WordSpec
29-
with Matchers
30-
with GivenWhenThen
31-
with OptionValues
32-
with BeforeAndAfter
33-
with PropertyChecks
34-
with Benchmark
35-
with Logger {
27+
trait MessagePackSpec extends WordSpec with Matchers with GivenWhenThen with OptionValues with BeforeAndAfter with PropertyChecks with Benchmark with Logger {
3628

3729
implicit def toTag(s: String): Tag = Tag(s)
3830

3931
def toHex(arr: Array[Byte]) = arr.map(x => f"$x%02x").mkString(" ")
4032

4133
def createMessagePackData(f: MessagePacker => Unit): Array[Byte] = {
42-
val b = new
43-
ByteArrayOutputStream()
34+
val b = new ByteArrayOutputStream()
4435
val packer = MessagePack.newDefaultPacker(b)
4536
f(packer)
4637
packer.close()
4738
b.toByteArray
4839
}
4940
}
5041

51-
trait Benchmark
52-
extends Timer {
42+
trait Benchmark extends Timer {
5343

5444
val numWarmUpRuns = 10
5545

@@ -66,4 +56,4 @@ trait Benchmark
6656

6757
super.block(name, repeat)(f)
6858
}
69-
}
59+
}

0 commit comments

Comments
 (0)