From ab0e62a5424c64493f061f5495d2ed2bda156ab3 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Thu, 22 Jul 2021 10:05:21 +0200 Subject: [PATCH 01/13] WIP quick experiment building with scala 3 --- build.sbt | 12 ++++++++++-- project/build.properties | 2 +- .../shared/src/main/scala/spray/json/package.scala | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index cca86e55..89272741 100644 --- a/build.sbt +++ b/build.sbt @@ -6,6 +6,7 @@ lazy val scala210 = "2.10.7" lazy val scala211 = "2.11.12" lazy val scala212 = "2.12.10" lazy val scala213 = "2.13.1" +lazy val scala3 = "3.0.1" lazy val sprayJson = crossProject(JVMPlatform, JSPlatform, NativePlatform) @@ -29,7 +30,13 @@ lazy val sprayJson = .enablePlugins(spray.boilerplate.BoilerplatePlugin) .platformsSettings(JVMPlatform, JSPlatform)( libraryDependencies ++= { - if (scalaMinorVersion.value >= 11) + if (scalaMajorVersion.value >= 3) + Seq( + "org.specs2" %%% "specs2-core" % "5.0.0-ALPHA-03" % "test", + "org.specs2" %%% "specs2-scalacheck" % "5.0.0-ALPHA-03" % "test", + "org.scalacheck" %%% "scalacheck" % "1.15.4" % "test" + ) + else if (scalaMinorVersion.value >= 11) Seq( "org.specs2" %%% "specs2-core" % "4.5.1" % "test", "org.specs2" %%% "specs2-scalacheck" % "4.5.1" % "test", @@ -45,7 +52,7 @@ lazy val sprayJson = ) .configurePlatforms(JVMPlatform)(_.enablePlugins(SbtOsgi)) .jvmSettings( - crossScalaVersions := Seq(scala213, scala212, scala211, scala210), + crossScalaVersions := Seq(scala3, scala213, scala212, scala211, scala210), OsgiKeys.exportPackage := Seq("""spray.json.*;version="${Bundle-Version}""""), OsgiKeys.importPackage := Seq("""scala.*;version="$"""".format(scalaVersion.value)), OsgiKeys.importPackage ++= Seq("""spray.json;version="${Bundle-Version}"""", "*"), @@ -100,4 +107,5 @@ lazy val root = (project in file(".")) scalaVersion := scala212, ) +def scalaMajorVersion: Def.Initialize[Long] = Def.setting { CrossVersion.partialVersion(scalaVersion.value).get._1 } def scalaMinorVersion: Def.Initialize[Long] = Def.setting { CrossVersion.partialVersion(scalaVersion.value).get._2 } diff --git a/project/build.properties b/project/build.properties index 5a9ed925..9edb75b7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.4 +sbt.version=1.5.4 diff --git a/spray-json/shared/src/main/scala/spray/json/package.scala b/spray-json/shared/src/main/scala/spray/json/package.scala index c96e1c43..a51d6d7c 100644 --- a/spray-json/shared/src/main/scala/spray/json/package.scala +++ b/spray-json/shared/src/main/scala/spray/json/package.scala @@ -26,7 +26,7 @@ package object json { def jsonReader[T](implicit reader: JsonReader[T]) = reader def jsonWriter[T](implicit writer: JsonWriter[T]) = writer - implicit def enrichAny[T](any: T) = new RichAny(any) + implicit def enrichAny[T](any: T): RichAny[T] = new RichAny(any) def enrichString(string: String) = new RichString(string) implicit class RichWithInput[I](any: I)(implicit i: Input[I]) { def parseJson: JsValue = json.parseJson(any) From 6ab4676bed3a87a0c9b25002c48bd26c63fb3788 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Thu, 22 Jul 2021 12:23:37 +0200 Subject: [PATCH 02/13] fix self type for Scala 3 --- .../spray/json/ProductFormatsInstances.scala.template | 2 +- spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spray-json/jvm/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template b/spray-json/jvm/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template index 882764f1..21fee1c9 100644 --- a/spray-json/jvm/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template +++ b/spray-json/jvm/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template @@ -18,7 +18,7 @@ package spray.json import scala.reflect.{ classTag, ClassTag } -trait ProductFormatsInstances { self: ProductFormats with StandardFormats => +trait ProductFormatsInstances { self: ProductFormats with StandardFormats with AdditionalFormats => [# // Case classes with 1 parameters /** diff --git a/spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala b/spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala index ee0150e7..d9bee928 100644 --- a/spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala +++ b/spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala @@ -26,7 +26,7 @@ import scala.reflect.ClassTag * (especially case classes) */ trait ProductFormats extends ProductFormatsInstances { - this: StandardFormats => + this: StandardFormats with AdditionalFormats => def jsonFormatN[T](construct: () => T): RootJsonFormat[T] = new RootJsonFormat[T] { @@ -145,7 +145,7 @@ object ProductFormats { * optional members as `None`.) */ trait NullOptions extends ProductFormats { - this: StandardFormats => + this: StandardFormats with AdditionalFormats => override protected def productElement2Field[T](fieldName: String, p: Product, ix: Int, rest: List[JsField])(implicit writer: JsonWriter[T]) = { val value = p.productElement(ix).asInstanceOf[T] From ff53f9d244d8afac7f560e41b89736cf474087e4 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Thu, 22 Jul 2021 12:29:32 +0200 Subject: [PATCH 03/13] some Scala 3 fixes --- .../test/scala/spray/json/JsonParserSpecJvm.scala | 2 +- .../test/scala/spray/json/ProductFormatsSpec.scala | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spray-json/jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala b/spray-json/jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala index b00b6a64..df83670d 100644 --- a/spray-json/jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala +++ b/spray-json/jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala @@ -60,7 +60,7 @@ class JsonParserSpecJvm extends Specification { queue.peek } - val i: Int = Iterator.iterate(1)(1+).indexWhere(depth => probe(depth, maxDepth = 1000) contains "stackoverflow") + val i: Int = Iterator.iterate(1)(1.+).indexWhere(depth => probe(depth, maxDepth = 1000) contains "stackoverflow") println(s"Overflowing stack at $i which means we need about ${stackSize / i} bytes per recursive call") val maxDepth = i / 4 // should give lots of room diff --git a/spray-json/jvm/src/test/scala/spray/json/ProductFormatsSpec.scala b/spray-json/jvm/src/test/scala/spray/json/ProductFormatsSpec.scala index 40f01b84..eb2cfa4f 100644 --- a/spray-json/jvm/src/test/scala/spray/json/ProductFormatsSpec.scala +++ b/spray-json/jvm/src/test/scala/spray/json/ProductFormatsSpec.scala @@ -33,13 +33,13 @@ class ProductFormatsSpec extends Specification { trait TestProtocol { this: DefaultJsonProtocol => - implicit val test0Format = jsonFormatN(Test0) - implicit val test2Format = jsonFormatN(Test2.apply _) - implicit def test3Format[A: JsonFormat, B: JsonFormat] = jsonFormatN(Test3[A, B] _) - implicit def test4Format = jsonFormatN(Test4.apply _) - implicit def testTransientFormat = jsonFormatN(TestTransient) - implicit def testStaticFormat = jsonFormatN(TestStatic) - implicit def testMangledFormat = jsonFormatN(TestMangled) + implicit val test0Format: JsonFormat[Test0] = jsonFormatN(Test0.apply _) + implicit val test2Format: JsonFormat[Test2] = jsonFormatN(Test2.apply _) + implicit def test3Format[A: JsonFormat, B: JsonFormat]: JsonFormat[Test3[A, B]] = jsonFormatN(Test3.apply[A, B] _) + implicit def test4Format: JsonFormat[Test4] = jsonFormatN(Test4.apply _) + implicit def testTransientFormat: JsonFormat[TestTransient] = jsonFormatN(TestTransient.apply _) + implicit def testStaticFormat: JsonFormat[TestStatic] = jsonFormatN(TestStatic.apply _) + implicit def testMangledFormat: JsonFormat[TestMangled] = jsonFormatN(TestMangled.apply _) } object TestProtocol1 extends DefaultJsonProtocol with TestProtocol object TestProtocol2 extends DefaultJsonProtocol with TestProtocol with NullOptions From 316fe94dcbaf27f23527145f600cbf1ee0ffbe21 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Thu, 22 Jul 2021 12:45:48 +0200 Subject: [PATCH 04/13] Use cross-dependency on specs2 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 89272741..f2f0d69a 100644 --- a/build.sbt +++ b/build.sbt @@ -32,8 +32,8 @@ lazy val sprayJson = libraryDependencies ++= { if (scalaMajorVersion.value >= 3) Seq( - "org.specs2" %%% "specs2-core" % "5.0.0-ALPHA-03" % "test", - "org.specs2" %%% "specs2-scalacheck" % "5.0.0-ALPHA-03" % "test", + ("org.specs2" %%% "specs2-core" % "4.5.1" % "test").cross(CrossVersion.for3Use2_13), + ("org.specs2" %%% "specs2-scalacheck" % "4.5.1" % "test").cross(CrossVersion.for3Use2_13), "org.scalacheck" %%% "scalacheck" % "1.15.4" % "test" ) else if (scalaMinorVersion.value >= 11) From 9ade68e31bddb67d6a0a32d88d10521ee928fb9e Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Thu, 22 Jul 2021 12:52:44 +0200 Subject: [PATCH 05/13] more type annotations --- .../jvm/src/test/scala/spray/json/ProductFormatsSpec.scala | 4 ++-- spray-json/jvm/src/test/scala/spray/json/ReadmeSpec.scala | 2 +- .../src/test/scala/spray/json/AdditionalFormatsSpec.scala | 6 +++--- .../shared/src/test/scala/spray/json/CustomFormatSpec.scala | 2 +- .../src/test/scala/spray/json/StandardFormatsSpec.scala | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spray-json/jvm/src/test/scala/spray/json/ProductFormatsSpec.scala b/spray-json/jvm/src/test/scala/spray/json/ProductFormatsSpec.scala index eb2cfa4f..981fb3a2 100644 --- a/spray-json/jvm/src/test/scala/spray/json/ProductFormatsSpec.scala +++ b/spray-json/jvm/src/test/scala/spray/json/ProductFormatsSpec.scala @@ -108,7 +108,7 @@ class ProductFormatsSpec extends Specification { } "A JsonFormat for a case class with 18 parameters and created with `jsonFormat`" should { object Test18Protocol extends DefaultJsonProtocol { - implicit val test18Format = jsonFormatN(Test18.apply _) + implicit val test18Format: JsonFormat[Test18] = jsonFormatN(Test18.apply _) } case class Test18( a1: String, @@ -147,7 +147,7 @@ class ProductFormatsSpec extends Specification { "support the jsonFormatN syntax" in { case class Box[A](a: A) object BoxProtocol extends DefaultJsonProtocol { - implicit val boxFormat = jsonFormatN(Box[Int] _) + implicit val boxFormat: JsonFormat[Box[Int]] = jsonFormatN(Box[Int] _) } import BoxProtocol._ Box(42).toJson === JsObject(Map("a" -> JsNumber(42))) diff --git a/spray-json/jvm/src/test/scala/spray/json/ReadmeSpec.scala b/spray-json/jvm/src/test/scala/spray/json/ReadmeSpec.scala index 18876f87..2a26d0fe 100644 --- a/spray-json/jvm/src/test/scala/spray/json/ReadmeSpec.scala +++ b/spray-json/jvm/src/test/scala/spray/json/ReadmeSpec.scala @@ -45,7 +45,7 @@ class ReadmeSpec extends Specification { "The case class example" should { "behave as expected" in { object MyJsonProtocol extends DefaultJsonProtocol { - implicit val colorFormat = jsonFormatN(Color.apply _) + implicit val colorFormat: JsonFormat[Color] = jsonFormatN(Color.apply _) } import MyJsonProtocol._ color.toJson.convertTo[Color] mustEqual color diff --git a/spray-json/shared/src/test/scala/spray/json/AdditionalFormatsSpec.scala b/spray-json/shared/src/test/scala/spray/json/AdditionalFormatsSpec.scala index 8ac38ef5..197306ce 100644 --- a/spray-json/shared/src/test/scala/spray/json/AdditionalFormatsSpec.scala +++ b/spray-json/shared/src/test/scala/spray/json/AdditionalFormatsSpec.scala @@ -23,7 +23,7 @@ class AdditionalFormatsSpec extends Specification with RoundTripSpecBase { case class Container[A](inner: Option[A]) object ReaderProtocol extends DefaultJsonProtocol { - implicit def containerReader[T: JsonFormat] = lift { + implicit def containerReader[T: JsonFormat]: JsonFormat[Container[T]] = lift { new JsonReader[Container[T]] { def read(value: JsValue) = value match { case JsObject(fields) if fields.contains("content") => Container(Some(jsonReader[T].read(fields("content")))) @@ -34,7 +34,7 @@ class AdditionalFormatsSpec extends Specification with RoundTripSpecBase { } object WriterProtocol extends DefaultJsonProtocol { - implicit def containerWriter[T: JsonFormat] = lift { + implicit def containerWriter[T: JsonFormat]: JsonFormat[Container[T]] = lift { new JsonWriter[Container[T]] { def write(obj: Container[T]) = JsObject("content" -> obj.inner.toJson) } @@ -58,7 +58,7 @@ class AdditionalFormatsSpec extends Specification with RoundTripSpecBase { case class Foo(id: Long, name: String, foos: Option[List[Foo]] = None) object FooProtocol extends DefaultJsonProtocol { - implicit val fooProtocol: JsonFormat[Foo] = lazyFormat(jsonFormat(Foo, "id", "name", "foos")) + implicit val fooProtocol: JsonFormat[Foo] = lazyFormat(jsonFormat(Foo.apply, "id", "name", "foos")) } "The lazyFormat wrapper" should { diff --git a/spray-json/shared/src/test/scala/spray/json/CustomFormatSpec.scala b/spray-json/shared/src/test/scala/spray/json/CustomFormatSpec.scala index ff7b7147..ba3b46a1 100644 --- a/spray-json/shared/src/test/scala/spray/json/CustomFormatSpec.scala +++ b/spray-json/shared/src/test/scala/spray/json/CustomFormatSpec.scala @@ -22,7 +22,7 @@ class CustomFormatSpec extends Specification with DefaultJsonProtocol { case class MyType(name: String, value: Int) - implicit val MyTypeProtocol = new RootJsonFormat[MyType] { + implicit val MyTypeProtocol: JsonFormat[MyType] = new JsonFormat[MyType] { def read(json: JsValue) = { json.asJsObject.getFields("name", "value") match { case Seq(JsString(name), JsNumber(value)) => MyType(name, value.toInt) diff --git a/spray-json/shared/src/test/scala/spray/json/StandardFormatsSpec.scala b/spray-json/shared/src/test/scala/spray/json/StandardFormatsSpec.scala index 1fadd4ec..217ce6e6 100644 --- a/spray-json/shared/src/test/scala/spray/json/StandardFormatsSpec.scala +++ b/spray-json/shared/src/test/scala/spray/json/StandardFormatsSpec.scala @@ -57,7 +57,7 @@ class StandardFormatsSpec extends Specification with DefaultJsonProtocol { "be automatically provided from JsonFormat" in { trait X implicit def format: JsonFormat[X] = ??? - implicit def reader = implicitly[JsonReader[X]] + implicit def reader: JsonReader[X] = implicitly[JsonReader[X]] success } } @@ -65,7 +65,7 @@ class StandardFormatsSpec extends Specification with DefaultJsonProtocol { "be automatically provided from JsonFormat" in { trait X implicit def format: JsonFormat[X] = ??? - implicit def reader = implicitly[JsonWriter[X]] + implicit def reader: JsonWriter[X] = implicitly[JsonWriter[X]] success } } From 97c7c7dee5d31ef43bdc1f208753813c1d8d1b78 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Thu, 22 Jul 2021 12:53:16 +0200 Subject: [PATCH 06/13] Scala 3 compatible by-name param usage --- .../shared/src/test/scala/spray/json/JsonParserSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spray-json/shared/src/test/scala/spray/json/JsonParserSpec.scala b/spray-json/shared/src/test/scala/spray/json/JsonParserSpec.scala index d6caeae9..417b1b93 100644 --- a/spray-json/shared/src/test/scala/spray/json/JsonParserSpec.scala +++ b/spray-json/shared/src/test/scala/spray/json/JsonParserSpec.scala @@ -89,7 +89,7 @@ abstract class JsonParserSpec[T: Input](inputFromString: String => T) extends Sp def nanoBench(block: => Unit): Long = { // great microbenchmark (the comment must be kept, otherwise it's not true) - val f = block _ + val f = () => block // warmup (1 to 10).foreach(_ => f()) From fbd903be4dc773fe1c24b50d5e428c65131981ed Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Thu, 9 Sep 2021 11:31:17 +0200 Subject: [PATCH 07/13] fix ProductFormats reflection --- spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala b/spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala index d9bee928..a6c69524 100644 --- a/spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala +++ b/spray-json/jvm/src/main/scala/spray/json/ProductFormats.scala @@ -74,7 +74,7 @@ trait ProductFormats extends ProductFormatsInstances { _.getName.drop("copy$default$".length).takeWhile(_ != '(').toInt) val fields = clazz.getDeclaredFields.filterNot { f => import Modifier._ - (f.getModifiers & (TRANSIENT | STATIC | 0x1000 /* SYNTHETIC*/ )) > 0 + (f.getModifiers & (TRANSIENT | STATIC | 0x1000 /* SYNTHETIC*/ )) > 0 || f.getName.endsWith("$outer") } if (copyDefaultMethods.length != fields.length) sys.error("Case class " + clazz.getName + " declares additional fields") From a3637453c73b4a1c80bdc41ac874353e1ae55b51 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Thu, 9 Sep 2021 11:31:56 +0200 Subject: [PATCH 08/13] fix unicode tests \u unicode encodes don't seem to supported any more in Scala 3 (at least in tripple quoted strings) --- .../shared/src/test/scala/spray/json/PrettyPrinterSpec.scala | 4 ++-- .../shared/src/test/scala/spray/json/SortedPrinterSpec.scala | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spray-json/shared/src/test/scala/spray/json/PrettyPrinterSpec.scala b/spray-json/shared/src/test/scala/spray/json/PrettyPrinterSpec.scala index 1da06f16..f1f15b21 100644 --- a/spray-json/shared/src/test/scala/spray/json/PrettyPrinterSpec.scala +++ b/spray-json/shared/src/test/scala/spray/json/PrettyPrinterSpec.scala @@ -27,7 +27,7 @@ class PrettyPrinterSpec extends Specification { """{ | "Boolean no": false, | "Boolean yes":true, - | "Unic\u00f8de" : "Long string with newline\nescape", + | "Unicøde" : "Long string with newline\nescape", | "key with \"quotes\"" : "string", | "key with spaces": null, | "number": -1.2323424E-5, @@ -48,7 +48,7 @@ class PrettyPrinterSpec extends Specification { """{ | "Boolean no": false, | "Boolean yes": true, - | "Unic\u00f8de": "Long string with newline\nescape", + | "Unicøde": "Long string with newline\nescape", | "key with \"quotes\"": "string", | "key with spaces": null, | "number": -0.000012323424, diff --git a/spray-json/shared/src/test/scala/spray/json/SortedPrinterSpec.scala b/spray-json/shared/src/test/scala/spray/json/SortedPrinterSpec.scala index 8b3afb26..792d8b6b 100644 --- a/spray-json/shared/src/test/scala/spray/json/SortedPrinterSpec.scala +++ b/spray-json/shared/src/test/scala/spray/json/SortedPrinterSpec.scala @@ -24,7 +24,7 @@ class SortedPrinterSpec extends Specification { "print a more complicated JsObject nicely aligned with fields sorted" in { val obj = """{ - | "Unic\u00f8de" : "Long string with newline\nescape", + | "Unicøde" : "Long string with newline\nescape", | "Boolean no": false, | "number": -1.2323424E-5, | "key with \"quotes\"" : "string", @@ -43,7 +43,7 @@ class SortedPrinterSpec extends Specification { """{ | "Boolean no": false, | "Boolean yes": true, - | "Unic\u00f8de": "Long string with newline\nescape", + | "Unicøde": "Long string with newline\nescape", | "key with \"quotes\"": "string", | "key with spaces": null, | "number": -0.000012323424, From a6b1d8c9789d6cfdaac91bee5cfb34f151f5f1ac Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Tue, 16 Nov 2021 11:06:39 +0000 Subject: [PATCH 09/13] Use explicit type in JsonParserSpecJvm for Scala 2.10 --- .../jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spray-json/jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala b/spray-json/jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala index df83670d..32097bc2 100644 --- a/spray-json/jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala +++ b/spray-json/jvm/src/test/scala/spray/json/JsonParserSpecJvm.scala @@ -60,7 +60,9 @@ class JsonParserSpecJvm extends Specification { queue.peek } - val i: Int = Iterator.iterate(1)(1.+).indexWhere(depth => probe(depth, maxDepth = 1000) contains "stackoverflow") + // Explicit type needed to compile on Scala 2.10, can be inlined later + def inc(i: Int): Int = 1 + i + val i: Int = Iterator.iterate(1)(inc).indexWhere(depth => probe(depth, maxDepth = 1000) contains "stackoverflow") println(s"Overflowing stack at $i which means we need about ${stackSize / i} bytes per recursive call") val maxDepth = i / 4 // should give lots of room From 6aa89c89ab7c997c7a7653d0ea98ab2f047dd5c5 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Tue, 16 Nov 2021 12:09:00 +0000 Subject: [PATCH 10/13] mima --- build.sbt | 4 +++- project/plugins.sbt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index f2f0d69a..23c7a173 100644 --- a/build.sbt +++ b/build.sbt @@ -57,8 +57,10 @@ lazy val sprayJson = OsgiKeys.importPackage := Seq("""scala.*;version="$"""".format(scalaVersion.value)), OsgiKeys.importPackage ++= Seq("""spray.json;version="${Bundle-Version}"""", "*"), OsgiKeys.additionalHeaders := Map("-removeheaders" -> "Include-Resource,Private-Package"), + ThisBuild / mimaReportSignatureProblems := true, mimaPreviousArtifacts := { - if (scalaMinorVersion.value == 13) Set("io.spray" %% "spray-json" % "1.3.5") + if (scalaMajorVersion.value == 3) Set.empty + else if (scalaMinorVersion.value == 13) Set("io.spray" %% "spray-json" % "1.3.5") else Set("1.3.2", "1.3.3", "1.3.4", "1.3.5").map { v => "io.spray" %% "spray-json" % v } }, mimaBinaryIssueFilters := Seq( diff --git a/project/plugins.sbt b/project/plugins.sbt index 9acc89d5..8cd76334 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,7 +3,7 @@ addSbtPlugin("io.spray" % "sbt-boilerplate" % "0.6.1") addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.5") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2") -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.0") From 402e46bde3d20e5694e1bd1b953fe0291c463ae9 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Tue, 16 Nov 2021 12:18:33 +0000 Subject: [PATCH 11/13] Skip mima for 2.10 Since it's not supported anymore. While we'll still publish 2.10 artifacts, perhaps it's fine to stop checking binary compatibility. --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 23c7a173..4d4a86ec 100644 --- a/build.sbt +++ b/build.sbt @@ -61,6 +61,7 @@ lazy val sprayJson = mimaPreviousArtifacts := { if (scalaMajorVersion.value == 3) Set.empty else if (scalaMinorVersion.value == 13) Set("io.spray" %% "spray-json" % "1.3.5") + else if (scalaMinorVersion.value == 10) Set.empty else Set("1.3.2", "1.3.3", "1.3.4", "1.3.5").map { v => "io.spray" %% "spray-json" % v } }, mimaBinaryIssueFilters := Seq( From f8a2d83f21d848df3c4b97e582df32410ba7cb5b Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Tue, 16 Nov 2021 12:30:31 +0000 Subject: [PATCH 12/13] Add Scala 3.1.0 to Travis matrix --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5ae788fb..74a3a46b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ scala: - 2.11.12 - 2.12.10 - 2.13.1 + - 3.1.0 before_install: - sudo rm -r /usr/local/clang-7.0.0 From 0084fdbba666e853fa7e671e1bb58d772d70b735 Mon Sep 17 00:00:00 2001 From: Arnout Engelen Date: Tue, 16 Nov 2021 12:43:41 +0000 Subject: [PATCH 13/13] Update to Scala 3.1.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 4d4a86ec..257d95c8 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ lazy val scala210 = "2.10.7" lazy val scala211 = "2.11.12" lazy val scala212 = "2.12.10" lazy val scala213 = "2.13.1" -lazy val scala3 = "3.0.1" +lazy val scala3 = "3.1.0" lazy val sprayJson = crossProject(JVMPlatform, JSPlatform, NativePlatform)