summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2017-07-27 19:56:40 -0700
committerSeth Tisue <seth@tisue.net>2017-09-14 13:16:41 -0700
commit7089839dcfc1c91f195a4b1dcc6d7b60e40b210c (patch)
treee38509ffd689d673546f17f2a875cee5a583c3a4
parent8a421f066e99359a3d6fa4cd64cded206376d264 (diff)
downloadspray-json-7089839dcfc1c91f195a4b1dcc6d7b60e40b210c.tar.gz
spray-json-7089839dcfc1c91f195a4b1dcc6d7b60e40b210c.tar.bz2
spray-json-7089839dcfc1c91f195a4b1dcc6d7b60e40b210c.zip
replace pimp with 'rich', 'enrich', 'extension method'
and: * add MiMa so we know the change is binary compatible * use current Scala & sbt versions
-rw-r--r--.travis.yml2
-rw-r--r--CHANGELOG4
-rw-r--r--README.markdown2
-rw-r--r--build.sbt27
-rw-r--r--notes/1.1.0.markdown2
-rw-r--r--project/build.properties2
-rw-r--r--project/plugins.sbt4
-rw-r--r--src/main/scala/spray/json/package.scala24
8 files changed, 49 insertions, 18 deletions
diff --git a/.travis.yml b/.travis.yml
index 9c84d59..a4c0f79 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: scala
script:
- - sbt "+ test"
+ - sbt "+ test" "+ mimaReportBinaryIssues"
jdk:
- oraclejdk8
notifications:
diff --git a/CHANGELOG b/CHANGELOG
index 8d988f5..bae279e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
-Version 1.3.3 (1016-12-29)
+Version 1.3.3 (2016-12-29)
--------------------------
For Scala 2.12, this release brings no updates over 1.3.2 because the 2.12 release
@@ -102,7 +102,7 @@ Version 1.1.1 (2012-03-13)
Version 1.1.0 (2012-02-01)
--------------------------
- Added automatic case class field name extraction via new jsonFormatX overloads
-- Added 'asJson' pimp to Strings
+- Added 'asJson' extension method to Strings
- Added RootJsonFormat (JsonFormat for types corresponding to JSON document roots)
- Fixed problem of JSON object deserialization not being member-order independent
(removed JsField, turned JsObject(List[JsField]) into JsObject(Map[String, JsValue]))
diff --git a/README.markdown b/README.markdown
index e659e71..b840ac6 100644
--- a/README.markdown
+++ b/README.markdown
@@ -53,7 +53,7 @@ and do one or more of the following:
val json = jsonAst.prettyPrint // or .compactPrint
```
-* Convert any Scala object to a JSON AST using the pimped `toJson` method
+* Convert any Scala object to a JSON AST using the `toJson` extension method
```scala
val jsonAst = List(1, 2, 3).toJson
diff --git a/build.sbt b/build.sbt
index 2e451e0..955fcca 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,6 +1,6 @@
name := "spray-json"
-version := "1.3.3"
+version := "1.3.4-SNAPSHOT"
organization := "io.spray"
@@ -14,7 +14,7 @@ startYear := Some(2011)
licenses := Seq("Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt"))
-scalaVersion := "2.11.8"
+scalaVersion := "2.11.11"
scalacOptions ++= Seq("-feature", "-language:_", "-unchecked", "-deprecation", "-Xlint", "-encoding", "utf8")
@@ -44,28 +44,39 @@ osgiSettings
OsgiKeys.exportPackage := Seq("""spray.json.*;version="${Bundle-Version}"""")
-OsgiKeys.importPackage <<= scalaVersion { sv => Seq("""scala.*;version="$<range;[==,=+);%s>"""".format(sv)) }
+OsgiKeys.importPackage := Seq("""scala.*;version="$<range;[==,=+);%s>"""".format(scalaVersion.value))
OsgiKeys.importPackage ++= Seq("""spray.json;version="${Bundle-Version}"""", "*")
OsgiKeys.additionalHeaders := Map("-removeheaders" -> "Include-Resource,Private-Package")
+// Migration Manager
+mimaPreviousArtifacts := Set("io.spray" %% "spray-json" % "1.3.3")
+
///////////////
// publishing
///////////////
-crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1")
+crossScalaVersions := Seq("2.10.6", "2.11.11", "2.12.3")
-scalaBinaryVersion <<= scalaVersion(sV => if (CrossVersion.isStable(sV)) CrossVersion.binaryScalaVersion(sV) else sV)
+scalaBinaryVersion := {
+ val sV = scalaVersion.value
+ if (CrossVersion.isScalaApiCompatible(sV))
+ CrossVersion.binaryScalaVersion(sV)
+ else
+ sV
+}
publishMavenStyle := true
useGpg := true
-publishTo <<= version { v: String =>
+publishTo := {
val nexus = "https://oss.sonatype.org/"
- if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
- else Some("releases" at nexus + "service/local/staging/deploy/maven2")
+ if (version.value.trim.endsWith("SNAPSHOT"))
+ Some("snapshots" at nexus + "content/repositories/snapshots")
+ else
+ Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
pomIncludeRepository := { _ => false }
diff --git a/notes/1.1.0.markdown b/notes/1.1.0.markdown
index 2d09720..38b018c 100644
--- a/notes/1.1.0.markdown
+++ b/notes/1.1.0.markdown
@@ -4,7 +4,7 @@ and will have group id `cc.spray` rather than `cc.spray.json` as before.
Changes since the last release (1.0.1):
- Added automatic case class field name extraction via new `jsonFormatX` overloads
-- Added `asJson` pimp to Strings
+- Added `asJson` extension method to Strings
- Added `RootJsonFormat` (`JsonFormat` for types corresponding to JSON document roots)
- Fixed problem of JSON object deserialization not being member-order independent
(removed `JsField`, turned `JsObject(List[JsField])` into `JsObject(Map[String, JsValue])`)
diff --git a/project/build.properties b/project/build.properties
index 817bc38..c091b86 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=0.13.9
+sbt.version=0.13.16
diff --git a/project/plugins.sbt b/project/plugins.sbt
index b2c7588..b6edd90 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -2,4 +2,6 @@ addSbtPlugin("io.spray" % "sbt-boilerplate" % "0.5.9")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.7.0")
-addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") \ No newline at end of file
+addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
+
+addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.18")
diff --git a/src/main/scala/spray/json/package.scala b/src/main/scala/spray/json/package.scala
index f79b99e..37d63c2 100644
--- a/src/main/scala/spray/json/package.scala
+++ b/src/main/scala/spray/json/package.scala
@@ -25,9 +25,14 @@ package object json {
def jsonReader[T](implicit reader: JsonReader[T]) = reader
def jsonWriter[T](implicit writer: JsonWriter[T]) = writer
-
- implicit def pimpAny[T](any: T) = new PimpedAny(any)
- implicit def pimpString(string: String) = new PimpedString(string)
+
+ implicit def enrichAny[T](any: T) = new RichAny(any)
+ implicit def enrichString(string: String) = new RichString(string)
+
+ @deprecated("use enrichAny", "1.3.4")
+ def pimpAny[T](any: T) = new PimpedAny(any)
+ @deprecated("use enrichString", "1.3.4")
+ def pimpString(string: String) = new PimpedString(string)
}
package json {
@@ -35,13 +40,26 @@ package json {
case class DeserializationException(msg: String, cause: Throwable = null, fieldNames: List[String] = Nil) extends RuntimeException(msg, cause)
class SerializationException(msg: String) extends RuntimeException(msg)
+ private[json] class RichAny[T](any: T) {
+ def toJson(implicit writer: JsonWriter[T]): JsValue = writer.write(any)
+ }
+
+ private[json] class RichString(string: String) {
+ @deprecated("deprecated in favor of parseJson", "1.2.6")
+ def asJson: JsValue = parseJson
+ def parseJson: JsValue = JsonParser(string)
+ }
+
+ @deprecated("use RichAny", "1.3.4")
private[json] class PimpedAny[T](any: T) {
def toJson(implicit writer: JsonWriter[T]): JsValue = writer.write(any)
}
+ @deprecated("use RichString", "1.3.4")
private[json] class PimpedString(string: String) {
@deprecated("deprecated in favor of parseJson", "1.2.6")
def asJson: JsValue = parseJson
def parseJson: JsValue = JsonParser(string)
}
+
}