| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
22 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + maxColumn = 180 | ||
| 2 | + style = defaultWithAlign | ||
| 3 | + optIn.breaksInsideChains = true | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,25 +5,27 @@ cache: | |||
| 5 | 5 | - $HOME/.m2/repository/ | |
| 6 | 6 | - $HOME/.ivy2/cache/ | |
| 7 | 7 | - $HOME/.sbt/boot/ | |
| 8 | + - $HOME/.coursier | ||
| 8 | 9 | ||
| 9 | 10 | sudo: false | |
| 10 | 11 | ||
| 11 | - jdk: | ||
| 12 | - - openjdk7 | ||
| 13 | - - oraclejdk8 | ||
| 14 | - | ||
| 15 | 12 | branches: | |
| 16 | 13 | only: | |
| 17 | 14 | - develop | |
| 18 | 15 | ||
| 19 | - script: | ||
| 20 | - - ./sbt jcheckStyle | ||
| 21 | - - ./sbt test | ||
| 22 | - - ./sbt test -J-Dmsgpack.universal-buffer=true | ||
| 23 | - | ||
| 24 | 16 | matrix: | |
| 25 | 17 | 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 | ||
| 27 | 29 | group: edge | |
| 28 | 30 | sudo: required | |
| 29 | 31 | jdk: oraclejdk9 | |
@@ -32,16 +34,5 @@ matrix: | |||
| 32 | 34 | packages: | |
| 33 | 35 | - oracle-java9-installer | |
| 34 | 36 | 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 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,6 +74,7 @@ Here is a list of sbt commands for daily development: | |||
| 74 | 74 | > findbugs # Produce findbugs report in target/findbugs | |
| 75 | 75 | > jacoco:cover # Report the code coverage of tests to target/jacoco folder | |
| 76 | 76 | > jcheckStyle # Run check style | |
| 77 | + > scalafmt # Reformat Scala codes | ||
| 77 | 78 | ``` | |
| 78 | 79 | ||
| 79 | 80 | ### Publishing | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,60 +1,53 @@ | |||
| 1 | - import de.johoop.findbugs4sbt.ReportType | ||
| 2 | 1 | import ReleaseTransformations._ | |
| 3 | 2 | ||
| 4 | - val buildSettings = findbugsSettings ++ jacoco.settings ++ osgiSettings ++ Seq[Setting[_]]( | ||
| 3 | + val buildSettings = Seq[Setting[_]]( | ||
| 5 | 4 | organization := "org.msgpack", | |
| 6 | 5 | organizationName := "MessagePack", | |
| 7 | 6 | organizationHomepage := Some(new URL("http://msgpack.org/")), | |
| 8 | 7 | description := "MessagePack for Java", | |
| 9 | - scalaVersion := "2.11.11", | ||
| 8 | + scalaVersion := "2.12.4", | ||
| 10 | 9 | logBuffered in Test := false, | |
| 10 | + // msgpack-java should be a pure-java library, so remove Scala specific configurations | ||
| 11 | 11 | autoScalaLibrary := false, | |
| 12 | 12 | crossPaths := false, | |
| 13 | 13 | // For performance testing, ensure each test run one-by-one | |
| 14 | 14 | concurrentRestrictions in Global := Seq( | |
| 15 | 15 | Tags.limit(Tags.Test, 1) | |
| 16 | 16 | ), | |
| 17 | 17 | // 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"), | ||
| 19 | 19 | 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"), | ||
| 21 | 21 | // Use lenient validation mode when generating Javadoc (for Java8) | |
| 22 | 22 | javacOptions in doc := { | |
| 23 | - val opts = Seq("-source", "1.6") | ||
| 23 | + val opts = Seq("-source", "1.7") | ||
| 24 | 24 | if (scala.util.Properties.isJavaAtLeast("1.8")) { | |
| 25 | 25 | opts ++ Seq("-Xdoclint:none") | |
| 26 | - } | ||
| 27 | - else { | ||
| 26 | + } else { | ||
| 28 | 27 | opts | |
| 29 | 28 | } | |
| 30 | 29 | }, | |
| 31 | 30 | // Release settings | |
| 32 | 31 | releaseTagName := { (version in ThisBuild).value }, | |
| 33 | 32 | 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 | + ), | ||
| 51 | 46 | // Find bugs | |
| 52 | - findbugsReportType := Some(ReportType.FancyHtml), | ||
| 47 | + findbugsReportType := Some(FindbugsReport.FancyHtml), | ||
| 53 | 48 | findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html"), | |
| 54 | - | ||
| 55 | 49 | // Style check config: (sbt-jchekcstyle) | |
| 56 | 50 | jcheckStyleConfig := "facebook", | |
| 57 | - | ||
| 58 | 51 | // Run jcheckstyle both for main and test codes | |
| 59 | 52 | (compile in Compile) := ((compile in Compile) dependsOn (jcheckStyle in Compile)).value, | |
| 60 | 53 | (compile in Test) := ((compile in Test) dependsOn (jcheckStyle in Test)).value | |
@@ -64,57 +57,61 @@ val junitInterface = "com.novocode" % "junit-interface" % "0.11" % "test" | |||
| 64 | 57 | ||
| 65 | 58 | // Project settings | |
| 66 | 59 | 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) | ||
| 77 | 71 | ||
| 78 | 72 | 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 | + ) | ||
| 120 | 97 | ||
| 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) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,15 +23,11 @@ class MessageBufferPackerTest extends MessagePackSpec { | |||
| 23 | 23 | "MessageBufferPacker" should { | |
| 24 | 24 | "be equivalent to ByteArrayOutputStream" in { | |
| 25 | 25 | 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"))) | ||
| 29 | 27 | ||
| 30 | - val stream = new ByteArrayOutputStream | ||
| 28 | + val stream = new ByteArrayOutputStream | ||
| 31 | 29 | 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"))) | ||
| 35 | 31 | packer2.flush | |
| 36 | 32 | ||
| 37 | 33 | packer1.toByteArray shouldBe stream.toByteArray | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,15 +22,13 @@ import org.scalatest.exceptions.TestFailedException | |||
| 22 | 22 | import scala.util.Random | |
| 23 | 23 | ||
| 24 | 24 | /** | |
| 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 { | ||
| 29 | 28 | "MessageFormat" should { | |
| 30 | 29 | "cover all byte codes" in { | |
| 31 | 30 | def checkV(b: Byte, tpe: ValueType) { | |
| 32 | - try | ||
| 33 | - MessageFormat.valueOf(b).getValueType shouldBe tpe | ||
| 31 | + try MessageFormat.valueOf(b).getValueType shouldBe tpe | ||
| 34 | 32 | catch { | |
| 35 | 33 | case e: TestFailedException => | |
| 36 | 34 | error(f"Failure when looking at byte ${b}%02x") | |
@@ -80,7 +78,6 @@ class MessageFormatTest | |||
| 80 | 78 | check(Code.EXT16, ValueType.EXTENSION, MessageFormat.EXT16) | |
| 81 | 79 | check(Code.EXT32, ValueType.EXTENSION, MessageFormat.EXT32) | |
| 82 | 80 | ||
| 83 | - | ||
| 84 | 81 | check(Code.INT8, ValueType.INTEGER, MessageFormat.INT8) | |
| 85 | 82 | check(Code.INT16, ValueType.INTEGER, MessageFormat.INT16) | |
| 86 | 83 | check(Code.INT32, ValueType.INTEGER, MessageFormat.INT32) | |
@@ -94,7 +91,6 @@ class MessageFormatTest | |||
| 94 | 91 | check(Code.STR16, ValueType.STRING, MessageFormat.STR16) | |
| 95 | 92 | check(Code.STR32, ValueType.STRING, MessageFormat.STR32) | |
| 96 | 93 | ||
| 97 | - | ||
| 98 | 94 | check(Code.FLOAT32, ValueType.FLOAT, MessageFormat.FLOAT32) | |
| 99 | 95 | check(Code.FLOAT64, ValueType.FLOAT, MessageFormat.FLOAT64) | |
| 100 | 96 | ||
@@ -107,7 +103,7 @@ class MessageFormatTest | |||
| 107 | 103 | } | |
| 108 | 104 | ||
| 109 | 105 | "improve the valueOf performance" in { | |
| 110 | - val N = 1000000 | ||
| 106 | + val N = 1000000 | ||
| 111 | 107 | val idx = (0 until N).map(x => Random.nextInt(256).toByte).toArray[Byte] | |
| 112 | 108 | ||
| 113 | 109 | // Initialize | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,32 +24,22 @@ import xerial.core.util.{TimeReport, Timer} | |||
| 24 | 24 | ||
| 25 | 25 | import scala.language.implicitConversions | |
| 26 | 26 | ||
| 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 { | ||
| 36 | 28 | ||
| 37 | 29 | implicit def toTag(s: String): Tag = Tag(s) | |
| 38 | 30 | ||
| 39 | 31 | def toHex(arr: Array[Byte]) = arr.map(x => f"$x%02x").mkString(" ") | |
| 40 | 32 | ||
| 41 | 33 | def createMessagePackData(f: MessagePacker => Unit): Array[Byte] = { | |
| 42 | - val b = new | ||
| 43 | - ByteArrayOutputStream() | ||
| 34 | + val b = new ByteArrayOutputStream() | ||
| 44 | 35 | val packer = MessagePack.newDefaultPacker(b) | |
| 45 | 36 | f(packer) | |
| 46 | 37 | packer.close() | |
| 47 | 38 | b.toByteArray | |
| 48 | 39 | } | |
| 49 | 40 | } | |
| 50 | 41 | ||
| 51 | - trait Benchmark | ||
| 52 | - extends Timer { | ||
| 42 | + trait Benchmark extends Timer { | ||
| 53 | 43 | ||
| 54 | 44 | val numWarmUpRuns = 10 | |
| 55 | 45 | ||
@@ -66,4 +56,4 @@ trait Benchmark | |||
| 66 | 56 | ||
| 67 | 57 | super.block(name, repeat)(f) | |
| 68 | 58 | } | |
| 69 | - } | ||
| 59 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments