Skip to content

Commit 2b38e70

Browse files
committed
Reformat
1 parent bccc1e1 commit 2b38e70

18 files changed

+605
-607
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

build.sbt

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,31 @@ val buildSettings = Seq[Setting[_]](
2323
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-
releaseStepCommand("publishSigned"),
42-
setNextVersion,
43-
commitNextVersion,
44-
releaseStepCommand("sonatypeReleaseAll"),
45-
pushChanges
46-
),
47-
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+
),
4846
// Find bugs
4947
findbugsReportType := Some(FindbugsReport.FancyHtml),
5048
findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html"),
51-
5249
// Style check config: (sbt-jchekcstyle)
5350
jcheckStyleConfig := "facebook",
54-
5551
// Run jcheckstyle both for main and test codes
5652
(compile in Compile) := ((compile in Compile) dependsOn (jcheckStyle in Compile)).value,
5753
(compile in Test) := ((compile in Test) dependsOn (jcheckStyle in Test)).value
@@ -61,59 +57,61 @@ val junitInterface = "com.novocode" % "junit-interface" % "0.11" % "test"
6157

6258
// Project settings
6359
lazy val root = Project(id = "msgpack-java", base = file("."))
64-
.settings(
65-
buildSettings,
66-
// Do not publish the root project
67-
publishArtifact := false,
68-
publish := {},
69-
publishLocal := {},
70-
findbugs := {
71-
// do not run findbugs for the root project
72-
}
73-
).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)
7471

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

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)