diff --git a/.mill-version b/.mill-version index ecd2d5d92..cb9119316 100644 --- a/.mill-version +++ b/.mill-version @@ -1,2 +1,2 @@ -0.11.6 +0.11.7 diff --git a/build.sc b/build.sc index 15f79569e..557a165b0 100644 --- a/build.sc +++ b/build.sc @@ -15,18 +15,18 @@ import de.tobiasroeser.mill.vcs.version.VcsVersion import com.github.lolgab.mill.mima._ val scala212 = "2.12.18" -val scala213 = "2.13.11" +val scala213 = "2.13.12" -val scala3 = "3.3.0" +val scala3 = "3.3.1" val scalaNative = "0.4.14" -val acyclic = "0.3.8" +val acyclic = "0.3.9" val sourcecode = "0.3.0" val dottyCustomVersion = Option(sys.props("dottyVersion")) val scala2JVMVersions = Seq(scala212, scala213) -val scalaVersions = scala2JVMVersions// ++ Seq(scala3) ++ dottyCustomVersion +val scalaVersions = scala2JVMVersions ++ Seq(scala3) ++ dottyCustomVersion trait CommonPlatformModule extends ScalaModule with PlatformScalaModule{ @@ -58,6 +58,10 @@ trait CommonPublishModule ) ) + def scalacPluginIvyDeps = + super.scalacPluginIvyDeps() ++ Agg(ivy"com.lihaoyi::unroll-plugin:0.1.12") + + def publishProperties: Target[Map[String, String]] = super.publishProperties() ++ Map( "info.releaseNotesURL" -> "https://com-lihaoyi.github.io/upickle/#VersionHistory" ) @@ -219,7 +223,10 @@ object ujson extends Module{ object upickle extends Module{ object core extends Module { trait CommonCoreModule extends CommonPublishModule { - def ivyDeps = Agg(ivy"com.lihaoyi::geny::1.0.0") + def ivyDeps = Agg( + ivy"com.lihaoyi::geny::1.0.0", + ivy"com.lihaoyi::unroll-annotation:0.1.12" + ) } object js extends Cross[CoreJsModule](scalaVersions) @@ -379,7 +386,7 @@ trait BenchModule extends CommonPlatformModule{ object bench extends Module { object js extends BenchModule with ScalaJSModule { - def scalaJSVersion = "1.13.0" + def scalaJSVersion = "1.13.1" def moduleDeps = Seq(upickle.js(scala213).test) } diff --git a/ujson/src/ujson/package.scala b/ujson/src/ujson/package.scala index cf1972ac0..4cb9c6468 100644 --- a/ujson/src/ujson/package.scala +++ b/ujson/src/ujson/package.scala @@ -1,16 +1,13 @@ import upickle.core.NoOpVisitor import upickle.core.BufferedValue - +import scala.annotation.unroll package object ujson{ def transform[T](t: Readable, v: upickle.core.Visitor[_, T], - sortKeys: Boolean = false): T = { + @unroll sortKeys: Boolean = false): T = { BufferedValue.maybeSortKeysTransform(Readable, t, sortKeys, v) } -// @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def transform[T](t: Readable, - v: upickle.core.Visitor[_, T]): T = transform(t, v, sortKeys = false) /** * Read the given JSON input as a JSON struct */ @@ -25,19 +22,12 @@ package object ujson{ def write(t: Value.Value, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): String = { + @unroll sortKeys: Boolean = false): String = { val writer = new java.io.StringWriter writeTo(t, writer, indent, escapeUnicode, sortKeys) writer.toString } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def write(t: Value.Value, - indent: Int, - escapeUnicode: Boolean): String = { - write(t, indent, escapeUnicode, sortKeys = false) - } - /** * Write the given JSON struct as a JSON String to the given Writer */ @@ -45,50 +35,27 @@ package object ujson{ out: java.io.Writer, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Unit = { + @unroll sortKeys: Boolean = false): Unit = { transform(t, Renderer(out, indent, escapeUnicode), sortKeys) } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeTo(t: Value.Value, - out: java.io.Writer, - indent: Int, - escapeUnicode: Boolean): Unit = { - writeTo(t, out, indent, escapeUnicode, sortKeys = false) - } - def writeToOutputStream(t: Value.Value, out: java.io.OutputStream, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Unit = { + @unroll sortKeys: Boolean = false): Unit = { transform(t, new BaseByteRenderer(out, indent, escapeUnicode), sortKeys) } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeToOutputStream(t: Value.Value, - out: java.io.OutputStream, - indent: Int, - escapeUnicode: Boolean): Unit = { - writeToOutputStream(t, out, indent, escapeUnicode, sortKeys = false) - } - def writeToByteArray(t: Value.Value, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Array[Byte] = { + @unroll sortKeys: Boolean = false): Array[Byte] = { val baos = new java.io.ByteArrayOutputStream writeToOutputStream(t, baos, indent, escapeUnicode, sortKeys) baos.toByteArray } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeToByteArray(t: Value.Value, - indent: Int, - escapeUnicode: Boolean): Array[Byte] = { - writeToByteArray(t, indent, escapeUnicode, sortKeys = false) - } - /** * Parse the given JSON input, failing if it is invalid */ @@ -100,18 +67,12 @@ package object ujson{ def reformat(s: Readable, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): String = { + @unroll sortKeys: Boolean = false): String = { val writer = new java.io.StringWriter() reformatTo(s, writer, indent, escapeUnicode, sortKeys) writer.toString } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def reformat(s: Readable, - indent: Int, - escapeUnicode: Boolean): String = { - reformat(s, indent, escapeUnicode, sortKeys = false) - } /** * Parse the given JSON input and write it to a string with * the configured formatting to the given Writer @@ -120,17 +81,10 @@ package object ujson{ out: java.io.Writer, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Unit = { + @unroll sortKeys: Boolean = false): Unit = { transform(s, Renderer(out, indent, escapeUnicode), sortKeys) } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def reformatTo(s: Readable, - out: java.io.Writer, - indent: Int, - escapeUnicode: Boolean): Unit = { - reformatTo(s, out, indent, escapeUnicode, sortKeys = false) - } /** * Parse the given JSON input and write it to a string with * the configured formatting to the given Writer @@ -139,33 +93,19 @@ package object ujson{ out: java.io.OutputStream, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Unit = { + @unroll sortKeys: Boolean = false): Unit = { transform(s, new BaseByteRenderer(out, indent, escapeUnicode), sortKeys) } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def reformatToOutputStream(s: Readable, - out: java.io.OutputStream, - indent: Int, - escapeUnicode: Boolean): Unit = { - reformatToOutputStream(s, out, indent, escapeUnicode, sortKeys = false) - } - def reformatToByteArray(s: Readable, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Array[Byte] = { + @unroll sortKeys: Boolean = false): Array[Byte] = { val baos = new java.io.ByteArrayOutputStream reformatToOutputStream(s, baos, indent, escapeUnicode, sortKeys) baos.toByteArray } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def reformatToByteArray(s: Readable, - indent: Int, - escapeUnicode: Boolean): Array[Byte] = { - reformatToByteArray(s, indent, escapeUnicode, sortKeys = false) - } // End ujson @deprecated("use ujson.Value") type Js = Value diff --git a/upickle/src/upickle/Api.scala b/upickle/src/upickle/Api.scala index 98773c643..f634d32e1 100644 --- a/upickle/src/upickle/Api.scala +++ b/upickle/src/upickle/Api.scala @@ -6,6 +6,7 @@ import language.experimental.macros import language.higherKinds import upickle.core._ import scala.reflect.ClassTag +import scala.annotation.unroll /** * An instance of the upickle API. There's a default instance at @@ -50,28 +51,18 @@ trait Api def write[T: Writer](t: T, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): String = { + @unroll sortKeys: Boolean = false): String = { maybeSortKeysTransform(t, sortKeys, ujson.StringRenderer(indent, escapeUnicode)).toString } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def write[T: Writer](t: T, - indent: Int, - escapeUnicode: Boolean): String = { - write(t, indent, escapeUnicode, sortKeys = false) - } - /** * Write the given Scala value as a MessagePack binary */ def writeBinary[T: Writer](t: T, - sortKeys: Boolean = false): Array[Byte] = { + @unroll sortKeys: Boolean = false): Array[Byte] = { maybeSortKeysTransform(t, sortKeys, new upack.MsgPackWriter(new ByteArrayOutputStream())).toByteArray } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeBinary[T: Writer](t: T): Array[Byte] = writeBinary(t, sortKeys = false) - /** * Write the given Scala value as a JSON struct */ @@ -89,105 +80,64 @@ trait Api out: java.io.Writer, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Unit = { + @unroll sortKeys: Boolean = false): Unit = { maybeSortKeysTransform(t, sortKeys, new ujson.Renderer(out, indent = indent, escapeUnicode)) } - - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeTo[T: Writer](t: T, - out: java.io.Writer, - indent: Int, - escapeUnicode: Boolean): Unit = writeTo(t, out, indent, escapeUnicode, sortKeys = false) - def writeToOutputStream[T: Writer](t: T, out: java.io.OutputStream, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Unit = { + @unroll sortKeys: Boolean = false): Unit = { maybeSortKeysTransform(t, sortKeys, new ujson.BaseByteRenderer(out, indent = indent, escapeUnicode)) } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeToOutputStream[T: Writer](t: T, - out: java.io.OutputStream, - indent: Int, - escapeUnicode: Boolean): Unit = { - writeToOutputStream(t, out, indent, escapeUnicode, sortKeys = false) - } - def writeToByteArray[T: Writer](t: T, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): Array[Byte] = { + @unroll sortKeys: Boolean = false): Array[Byte] = { val out = new java.io.ByteArrayOutputStream() writeToOutputStream(t, out, indent, escapeUnicode, sortKeys) out.toByteArray } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeToByteArray[T: Writer](t: T, - indent: Int, - escapeUnicode: Boolean): Array[Byte] = { - writeToByteArray[T](t, indent, escapeUnicode, sortKeys = false) - } /** * Write the given Scala value as a JSON string via a `geny.Writable` */ def stream[T: Writer](t: T, indent: Int = -1, escapeUnicode: Boolean = false, - sortKeys: Boolean = false): geny.Writable = new geny.Writable{ + @unroll sortKeys: Boolean = false): geny.Writable = new geny.Writable{ override def httpContentType = Some("application/json") def writeBytesTo(out: java.io.OutputStream) = { maybeSortKeysTransform(t, sortKeys, new ujson.BaseByteRenderer(out, indent = indent, escapeUnicode)) } } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def stream[T: Writer](t: T, - indent: Int, - escapeUnicode: Boolean): geny.Writable = { - stream(t, indent, escapeUnicode, sortKeys = false) - } /** * Write the given Scala value as a MessagePack binary to the given OutputStream */ def writeBinaryTo[T: Writer](t: T, out: java.io.OutputStream, - sortKeys: Boolean = false): Unit = { + @unroll sortKeys: Boolean = false): Unit = { streamBinary[T](t, sortKeys = sortKeys).writeBytesTo(out) } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeBinaryTo[T: Writer](t: T, - out: java.io.OutputStream): Unit = { - writeBinaryTo(t, out, sortKeys = false) - } - def writeBinaryToByteArray[T: Writer](t: T, - sortKeys: Boolean = false): Array[Byte] = { + @unroll sortKeys: Boolean = false): Array[Byte] = { val out = new java.io.ByteArrayOutputStream() streamBinary[T](t, sortKeys = sortKeys).writeBytesTo(out) out.toByteArray } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def writeBinaryToByteArray[T: Writer](t: T): Array[Byte] = { - writeBinaryToByteArray(t, sortKeys = false) - } /** * Write the given Scala value as a MessagePack binary via a `geny.Writable` */ - def streamBinary[T: Writer](t: T, sortKeys: Boolean = false): geny.Writable = new geny.Writable{ + def streamBinary[T: Writer](t: T, @unroll sortKeys: Boolean = false): geny.Writable = new geny.Writable{ override def httpContentType = Some("application/octet-stream") def writeBytesTo(out: java.io.OutputStream) = maybeSortKeysTransform(t, sortKeys, new upack.MsgPackWriter(out)) } - // @deprecated("Binary Compatibility Stub", "upickle after 3.1.4") - def streamBinary[T: Writer](t: T): geny.Writable = { - streamBinary(t, sortKeys = false) - } def writer[T: Writer] = implicitly[Writer[T]]