From 9a7abcb9c1b845e3a52e626f266f18bf9416661b Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Wed, 30 Nov 2016 12:13:51 +0000 Subject: [PATCH 1/7] sbt/io upgrade --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index f9fd1706f..c35a8020a 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -6,7 +6,7 @@ object Dependencies { val scala211 = "2.11.8" val scala212 = "2.12.0" - private val sbtIO = "org.scala-sbt" %% "io" % "1.0.0-M7" + private val sbtIO = "org.scala-sbt" %% "io" % "1.0.0-M7-6c64b6b5b29e4e12e95b09ceda6d2e8dd6092f00" def getSbtModulePath(key: String, name: String) = { val localProps = new java.util.Properties() From 10183dcf3d4fc984b02d275ec80071cdf2ae99dd Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Tue, 6 Dec 2016 10:05:29 +0000 Subject: [PATCH 2/7] Upgrade sjson-new --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index c35a8020a..3c1f7df76 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -36,7 +36,7 @@ object Dependencies { val parserCombinator211 = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4" - val sjsonnewVersion = "0.5.1" + val sjsonnewVersion = "6.0.0" val sjsonnew = "com.eed3si9n" %% "sjson-new-core" % sjsonnewVersion val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion } From 11efe6846f9f85e02bc09efa0786f09025b85701 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Tue, 6 Dec 2016 11:27:17 +0000 Subject: [PATCH 3/7] new sjson --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 3c1f7df76..0e7040ab1 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -36,7 +36,7 @@ object Dependencies { val parserCombinator211 = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4" - val sjsonnewVersion = "6.0.0" + val sjsonnewVersion = "0.6.0-dnw" val sjsonnew = "com.eed3si9n" %% "sjson-new-core" % sjsonnewVersion val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion } From 65ffbfd1f24f843a591a575607da779aa8a526e1 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Tue, 6 Dec 2016 15:34:03 +0000 Subject: [PATCH 4/7] Add mavenLocal --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 5c41d937c..5fa4b8919 100644 --- a/build.sbt +++ b/build.sbt @@ -10,6 +10,7 @@ def commonSettings: Seq[Setting[_]] = Seq( // publishArtifact in packageDoc := false, resolvers += Resolver.typesafeIvyRepo("releases"), resolvers += Resolver.sonatypeRepo("snapshots"), + resolvers += Resolver.mavenLocal, // concurrentRestrictions in Global += Util.testExclusiveRestriction, testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"), From b0536f1a4d31f3cc5f4723a01dcf6ffaa06eee15 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 15 Dec 2016 18:02:39 +0000 Subject: [PATCH 5/7] new sjson-new --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 0e7040ab1..2c9535d9c 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -36,7 +36,7 @@ object Dependencies { val parserCombinator211 = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4" - val sjsonnewVersion = "0.6.0-dnw" + val sjsonnewVersion = "0.6.1-dnw" val sjsonnew = "com.eed3si9n" %% "sjson-new-core" % sjsonnewVersion val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion } From 7688de459b613e7d16db232c42d44fba0662203d Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 19 Dec 2016 15:23:51 +0000 Subject: [PATCH 6/7] Fix JsonFormat[HList] Introduce HListJF, used as an inner TC so the outer HCons/HNil JsonFormat can manage when the array starts and ends. --- .../scala/sbt/internal/util/HListFormat.scala | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/internal/util-cache/src/main/scala/sbt/internal/util/HListFormat.scala b/internal/util-cache/src/main/scala/sbt/internal/util/HListFormat.scala index 82ecf9ba3..6594896c8 100644 --- a/internal/util-cache/src/main/scala/sbt/internal/util/HListFormat.scala +++ b/internal/util-cache/src/main/scala/sbt/internal/util/HListFormat.scala @@ -9,29 +9,58 @@ trait HListFormat { private def forHNil[A <: HNil](hnil: A): JsonFormat[A] = new JsonFormat[A] { def write[J](x: A, builder: Builder[J]): Unit = { - if (builder.state != BuilderState.InArray) builder.beginArray() + builder.beginArray() builder.endArray() } - def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): A = { - if (unbuilder.state == UnbuilderState.InArray) unbuilder.endArray() - hnil + def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): A = jsOpt match { + case None => hnil + case Some(js) => unbuilder.beginArray(js); unbuilder.endArray(); hnil } } - implicit def hconsFormat[H, T <: HList](implicit hf: JsonFormat[H], tf: JsonFormat[T]): JsonFormat[H :+: T] = + implicit def hconsFormat[H, T <: HList](implicit hf: JsonFormat[H], tf: HListJF[T]): JsonFormat[H :+: T] = new JsonFormat[H :+: T] { def write[J](hcons: H :+: T, builder: Builder[J]) = { - if (builder.state != BuilderState.InArray) builder.beginArray() + builder.beginArray() hf.write(hcons.head, builder) tf.write(hcons.tail, builder) + builder.endArray() } def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]) = jsOpt match { case None => HCons(hf.read(None, unbuilder), tf.read(None, unbuilder)) case Some(js) => - if (unbuilder.state != UnbuilderState.InArray) unbuilder.beginArray(js) - HCons(hf.read(Some(unbuilder.nextElement), unbuilder), tf.read(Some(js), unbuilder)) + unbuilder.beginArray(js) + val hcons = HCons(hf.read(Some(unbuilder.nextElement), unbuilder), tf.read(Some(js), unbuilder)) + unbuilder.endArray() + hcons } } + + trait HListJF[A <: HList] { + def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]): A + def write[J](obj: A, builder: Builder[J]): Unit + } + + implicit def hconsHListJF[H, T <: HList](implicit hf: JsonFormat[H], tf: HListJF[T]): HListJF[H :+: T] = + new HListJF[H :+: T] { + def write[J](hcons: H :+: T, builder: Builder[J]) = { + hf.write(hcons.head, builder) + tf.write(hcons.tail, builder) + } + + def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]) = jsOpt match { + case None => HCons(hf.read(None, unbuilder), tf.read(None, unbuilder)) + case Some(js) => HCons(hf.read(Some(unbuilder.nextElement), unbuilder), tf.read(Some(js), unbuilder)) + } + } + + implicit val lnilHListJF1: HListJF[HNil] = hnilHListJF(HNil) + implicit val lnilHListJF2: HListJF[HNil.type] = hnilHListJF(HNil) + + implicit def hnilHListJF[A <: HNil](hnil: A): HListJF[A] = new HListJF[A] { + def write[J](hcons: A, builder: Builder[J]) = () + def read[J](jsOpt: Option[J], unbuilder: Unbuilder[J]) = hnil + } } From 5014e7f6b7f8cee0aada45b941782a1cef98dd94 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 22 Dec 2016 11:19:48 -0500 Subject: [PATCH 7/7] sjson-new 0.7.0 --- build.sbt | 2 +- project/Dependencies.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 5fa4b8919..4ac7d0e02 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ import Dependencies._ import Util._ import com.typesafe.tools.mima.core._, ProblemFilters._ -def baseVersion: String = "0.1.0-M15" +def baseVersion: String = "0.1.0-M16" def internalPath = file("internal") def commonSettings: Seq[Setting[_]] = Seq( diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 2c9535d9c..fe0fb53a5 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -6,7 +6,7 @@ object Dependencies { val scala211 = "2.11.8" val scala212 = "2.12.0" - private val sbtIO = "org.scala-sbt" %% "io" % "1.0.0-M7-6c64b6b5b29e4e12e95b09ceda6d2e8dd6092f00" + private val sbtIO = "org.scala-sbt" %% "io" % "1.0.0-M7" def getSbtModulePath(key: String, name: String) = { val localProps = new java.util.Properties() @@ -36,7 +36,7 @@ object Dependencies { val parserCombinator211 = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4" - val sjsonnewVersion = "0.6.1-dnw" + val sjsonnewVersion = "0.7.0" val sjsonnew = "com.eed3si9n" %% "sjson-new-core" % sjsonnewVersion val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion }