Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ jobs:
./sbt publishSigned
- name: Release to Sonatype
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
run: ./sbt sonatypeBundleRelease
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
run: ./sbt sonaRelease
4 changes: 2 additions & 2 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
distribution: adopt
- name: Publish snapshots
env:
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USER }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASS }}'
SONATYPE_USERNAME: '${{ secrets.SONATYPE_USERNAME }}'
SONATYPE_PASSWORD: '${{ secrets.SONATYPE_PASSWORD }}'
run: ./sbt publish
2 changes: 2 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version = 3.9.8
runner.dialect = scala213
maxColumn = 180
style = defaultWithAlign
optIn.breaksInsideChains = true
24 changes: 23 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ ThisBuild / dynverSonatypeSnapshots := true
// Use coursier friendly version separator
ThisBuild / dynverSeparator := "-"

// Publishing metadata
ThisBuild / homepage := Some(url("https://msgpack.org/"))
ThisBuild / licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/msgpack/msgpack-java"),
"scm:git@github.com:msgpack/msgpack-java.git"
)
)
ThisBuild / developers := List(
Developer(id = "frsyuki", name = "Sadayuki Furuhashi", email = "frsyuki@users.sourceforge.jp", url = url("https://github.com/frsyuki")),
Developer(id = "muga", name = "Muga Nishizawa", email = "muga.nishizawa@gmail.com", url = url("https://github.com/muga")),
Developer(id = "oza", name = "Tsuyoshi Ozawa", email = "ozawa.tsuyoshi@gmail.com", url = url("https://github.com/oza")),
Developer(id = "komamitsu", name = "Mitsunori Komatsu", email = "komamitsu@gmail.com", url = url("https://github.com/komamitsu")),
Developer(id = "xerial", name = "Taro L. Saito", email = "leo@xerial.org", url = url("https://github.com/xerial"))
)


val buildSettings = Seq[Setting[_]](
organization := "org.msgpack",
organizationName := "MessagePack",
Expand All @@ -38,7 +56,11 @@ val buildSettings = Seq[Setting[_]](
}
},
// Add sonatype repository settings
publishTo := sonatypePublishToBundle.value,
publishTo := {
val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/"
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
else localStaging.value
},
// Style check config: (sbt-jchekcstyle)
jcheckStyleConfig := "facebook",
// Run jcheckstyle both for main and test codes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package org.msgpack.core
import org.msgpack.core.MessagePackSpec.createMessagePackData
import wvlet.airspec.AirSpec

/**
*/
/** */
class InvalidDataReadTest extends AirSpec {

test("Reading long EXT32") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import wvlet.airspec.spi.AirSpecException

import scala.util.Random

/**
* Created on 2014/05/07.
/** Created on 2014/05/07.
*/
class MessageFormatTest extends AirSpec with Benchmark {
test("MessageFormat") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import wvlet.log.io.{TimeReport, Timer}
import java.io.ByteArrayOutputStream

object MessagePackSpec {
def toHex(arr: Array[Byte]) = arr.map(x => f"$x%02x").mkString(" ")
def toHex(arr: Array[Byte]) = arr.map(x => f"$x%02x").mkString(" ")
def createMessagePackData(f: MessagePacker => Unit): Array[Byte] = {
val b = new ByteArrayOutputStream()
val packer = MessagePack.newDefaultPacker(b)
Expand Down
23 changes: 11 additions & 12 deletions msgpack-core/src/test/scala/org/msgpack/core/MessagePackTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import java.nio.charset.{CodingErrorAction, UnmappableCharacterException}
import java.time.Instant
import scala.util.Random

/**
* Created on 2014/05/07.
/** Created on 2014/05/07.
*/
class MessagePackTest extends AirSpec with PropertyCheck with Benchmark {

Expand Down Expand Up @@ -396,7 +395,7 @@ class MessagePackTest extends AirSpec with PropertyCheck with Benchmark {
test("report errors when packing/unpacking malformed strings") {
pending("We need to produce malformed utf-8 strings in Java 8")
// Create 100 malformed UTF8 Strings
val r = new Random(0)
val r = new Random(0)
val malformedStrings = Iterator
.continually {
val b = new Array[Byte](10)
Expand Down Expand Up @@ -433,7 +432,7 @@ class MessagePackTest extends AirSpec with PropertyCheck with Benchmark {
test("report errors when packing/unpacking strings that contain unmappable characters") {

val unmappable = Array[Byte](0xfc.toByte, 0x0a.toByte)
//val unmappableChar = Array[Char](new Character(0xfc0a).toChar)
// val unmappableChar = Array[Char](new Character(0xfc0a).toChar)

// Report error on unmappable character
val unpackerConfig = new UnpackerConfig()
Expand Down Expand Up @@ -534,10 +533,9 @@ class MessagePackTest extends AirSpec with PropertyCheck with Benchmark {
m,
{ packer =>
packer.packMapHeader(v.length)
m.map {
case (k: Int, v: String) =>
packer.packInt(k)
packer.packString(v)
m.map { case (k: Int, v: String) =>
packer.packInt(k)
packer.packString(v)
}
},
{ unpacker =>
Expand Down Expand Up @@ -666,13 +664,14 @@ class MessagePackTest extends AirSpec with PropertyCheck with Benchmark {
val posLong = Gen.chooseNum[Long](-31557014167219200L, 31556889864403199L)
forAll(posLong) { (millis: Long) =>
val v = Instant.ofEpochMilli(millis)
check(v, { _.packTimestamp(millis) },
check(
v,
{ _.packTimestamp(millis) },
{ u =>
val extHeader = u.unpackExtensionTypeHeader()
if(extHeader.isTimestampType) {
if (extHeader.isTimestampType) {
u.unpackTimestamp(extHeader)
}
else {
} else {
fail("Cannot reach here")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import wvlet.log.io.IOUtil.withResource
import java.io.{ByteArrayOutputStream, File, FileInputStream, FileOutputStream}
import scala.util.Random

/**
*/
/** */
class MessagePackerTest extends AirSpec with Benchmark {

private def verifyIntSeq(answer: Array[Int], packed: Array[Byte]): Unit = {
Expand Down Expand Up @@ -141,8 +140,8 @@ class MessagePackerTest extends AirSpec with Benchmark {
32 -> 31,
34 -> 32
)
testCases.foreach {
case (bufferSize, stringSize) => test(bufferSize, stringSize)
testCases.foreach { case (bufferSize, stringSize) =>
test(bufferSize, stringSize)
}
}

Expand Down Expand Up @@ -234,7 +233,7 @@ class MessagePackerTest extends AirSpec with Benchmark {
}

test("compute totalWrittenBytes") {
val out = new ByteArrayOutputStream
val out = new ByteArrayOutputStream
val packerTotalWrittenBytes =
withResource(MessagePack.newDefaultPacker(out)) { packer =>
packer
Expand All @@ -255,7 +254,7 @@ class MessagePackerTest extends AirSpec with Benchmark {
test("support read-only buffer") {
val payload = Array[Byte](1)
val out = new ByteArrayOutputStream()
val packer = MessagePack
val packer = MessagePack
.newDefaultPacker(out)
.packBinaryHeader(1)
.writePayload(payload)
Expand Down Expand Up @@ -299,14 +298,14 @@ class MessagePackerTest extends AirSpec with Benchmark {

test("write raw binary") {
val packer = new MessagePack.PackerConfig().newBufferPacker()
val msg =
val msg =
Array[Byte](-127, -92, 116, 121, 112, 101, -92, 112, 105, 110, 103)
packer.writePayload(msg)
}

test("append raw binary") {
val packer = new MessagePack.PackerConfig().newBufferPacker()
val msg =
val msg =
Array[Byte](-127, -92, 116, 121, 112, 101, -92, 112, 105, 110, 103)
packer.addPayload(msg)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import scala.util.Random

object MessageUnpackerTest {
class SplitMessageBufferInput(array: Array[Array[Byte]]) extends MessageBufferInput {
var cursor = 0
var cursor = 0
override def next(): MessageBuffer = {
if (cursor < array.length) {
val a = array(cursor)
Expand All @@ -49,7 +49,7 @@ import org.msgpack.core.MessageUnpackerTest._

class MessageUnpackerTest extends AirSpec with Benchmark {

private val universal = MessageBuffer.allocate(0).isInstanceOf[MessageBufferU]
private val universal = MessageBuffer.allocate(0).isInstanceOf[MessageBufferU]
private def testData: Array[Byte] = {
val out = new ByteArrayOutputStream()
val packer = MessagePack.newDefaultPacker(out)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MessageBufferInputTest extends AirSpec {
Seq(0, 10, 500, 1000, 2000, 4000, 8000, 10000, 30000, 50000, 100000)

private def testData(size: Int): Array[Byte] = {
//debug(s"test data size: ${size}")
// debug(s"test data size: ${size}")
val b = new Array[Byte](size)
Random.nextBytes(b)
b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import wvlet.airspec.AirSpec
import java.nio.ByteBuffer
import scala.util.Random

/**
* Created on 2014/05/01.
/** Created on 2014/05/01.
*/
class MessageBufferTest extends AirSpec with Benchmark {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ package org.msgpack.core.example

import wvlet.airspec.AirSpec

/**
*/
/** */
class MessagePackExampleTest extends AirSpec {

test("example") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import org.scalacheck.Gen
import wvlet.airspec.AirSpec
import wvlet.airspec.spi.PropertyCheck

/**
*/
/** */
class ValueFactoryTest extends AirSpec with PropertyCheck {

private def isValid(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import org.msgpack.core.MessagePack.Code._
import org.msgpack.core.{MessageFormat, MessageFormatException}
import wvlet.airspec.AirSpec

/**
* Created on 2014/05/06.
/** Created on 2014/05/06.
*/
class ValueTypeTest extends AirSpec {

Expand Down
10 changes: 4 additions & 6 deletions msgpack-core/src/test/scala/org/msgpack/value/VariableTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import java.time.Instant
import java.util
import scala.jdk.CollectionConverters._

/**
*/
/** */
class VariableTest extends AirSpec with PropertyCheck {
private def check(pack: MessagePacker => Unit, checker: Variable => Unit): Unit = {
val packer = MessagePack.newDefaultBufferPacker()
Expand All @@ -38,8 +37,7 @@ class VariableTest extends AirSpec with PropertyCheck {
unpacker.close()
}

/**
* Test Value -> MsgPack -> Value
/** Test Value -> MsgPack -> Value
*/
private def roundTrip(v: Value): Unit = {
val packer = MessagePack.newDefaultBufferPacker()
Expand Down Expand Up @@ -210,8 +208,8 @@ class VariableTest extends AirSpec with PropertyCheck {
_.packDouble(x),
checker = { v =>
val iv = validateValue(v.asFloatValue(), asFloat = true)
//iv.toDouble shouldBe v
//iv.toFloat shouldBe x.toFloat
// iv.toDouble shouldBe v
// iv.toFloat shouldBe x.toFloat
}
)
}
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=1.10.7
sbt.version=1.11.3

3 changes: 1 addition & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
// TODO: Fixes jacoco error:
// java.lang.NoClassDefFoundError: Could not initialize class org.jacoco.core.internal.flow.ClassProbesAdapter
//addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.3.0")
addSbtPlugin("org.xerial.sbt" % "sbt-jcheckstyle" % "0.2.1")
addSbtPlugin("com.github.sbt" % "sbt-osgi" % "0.10.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.1")

scalacOptions ++= Seq("-deprecation", "-feature")
18 changes: 0 additions & 18 deletions sonatype.sbt

This file was deleted.

Loading