From 4de49f3e7c59099df82374e2c7573dd4954d2e31 Mon Sep 17 00:00:00 2001 From: jbwheatley Date: Fri, 4 Dec 2020 12:25:16 +0000 Subject: [PATCH] Scala 2.13.4 (#202) * make changes for 2.13.4: * update README --- README.md | 20 ++++++++++++------- build.sbt | 7 +++++-- project/build.properties | 2 +- project/plugins.sbt | 2 +- .../argonaut62/JsonConversionFunctions.scala | 6 +++--- .../circe13/JsonConversionFunctions.scala | 6 +++--- .../model/ScalaPactDescription.scala | 2 +- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 97dee250a..3a935dff4 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,18 @@ Scala-Pact is intended for Scala developers who are looking for a better way to ## Latest version is 2.4.0 -Scala-Pact now has two branches based on SBT requirements. +Scala-Pact currently only supports [v2 of the pact specification](https://github.com/pact-foundation/pact-specification/tree/version-2). Support for v3 is a future goal of the project. + +### Scala-Pact >= 3.0.x + +Before this version, the project versioning did not follow semantic versioning. From this point onwards, the version format will be `major.minor.patch`, and it should be noted that the `3` in the version number does *not* correspond to the version supporting v3 of the pact spec (for the time-being, at least). + +Scala-Pact now has two branches based on SBT requirements. #### SBT 1.x compatible (Latest 2.4.0) All development going forward begins at `2.3.x` and resides on the `master` branch. -For the sake of the maintainer's sanity, version 2.3.x and beyond will only support Scala 2.12 and SBT 1.x or greater. +For the sake of the maintainer's sanity, version 2.3.x and beyond will only support Scala 2.12 and SBT 1.x or greater. The project is currently cross-compiled across scala 2.12.12 and 2.13.4. #### SBT 0.13.x compatible (Latest 2.2.5) @@ -45,7 +51,7 @@ enablePlugins(ScalaPactPlugin) libraryDependencies ++= Seq( "com.itv" %% "scalapact-scalatest-suite" % "2.4.0" % "test", - "org.scalatest" %% "scalatest" % "3.0.5" % "test" + "org.scalatest" %% "scalatest" % "3.0.5" % "test" ) ``` @@ -68,9 +74,9 @@ enablePlugins(ScalaPactPlugin) libraryDependencies ++= Seq( "com.itv" %% "scalapact-circe-0-13" % "2.4.0" % "test", - "com.itv" %% "scalapact-http4s-0-21" % "2.4.0" % "test", - "com.itv" %% "scalapact-scalatest" % "2.4.0" % "test", - "org.scalatest" %% "scalatest" % "3.0.5" % "test" + "com.itv" %% "scalapact-http4s-0-21" % "2.4.0" % "test", + "com.itv" %% "scalapact-scalatest" % "2.4.0" % "test", + "org.scalatest" %% "scalatest" % "3.0.5" % "test" ) ``` @@ -84,7 +90,7 @@ Thanks to the way SBT works, that one plugin line will work in most cases, but i ```scala libraryDependencies ++= Seq( "com.itv" %% "scalapact-argonaut-6-2" % "2.4.0", - "com.itv" %% "scalapact-http4s-0-21" % "2.4.0" + "com.itv" %% "scalapact-http4s-0-21" % "2.4.0" ) addSbtPlugin("com.itv" % "sbt-scalapact-nodeps" % "2.4.0") diff --git a/build.sbt b/build.sbt index 443349cec..e3e5f4855 100644 --- a/build.sbt +++ b/build.sbt @@ -68,7 +68,7 @@ def compilerOptionsVersion(scalaVersion: String) = }) lazy val scalaVersion212: String = "2.12.12" -lazy val scalaVersion213: String = "2.13.3" +lazy val scalaVersion213: String = "2.13.4" lazy val supportedScalaVersions = List(scalaVersion212, scalaVersion213) ThisBuild / scalaVersion := scalaVersion212 @@ -93,7 +93,10 @@ lazy val commonSettings = Seq( Wart.LeakingSealed, Wart.Null, Wart.Var, - Wart.StringPlusAny + Wart.StringPlusAny, + Wart.PlatformDefault, + Wart.ListUnapply, + Wart.GlobalExecutionContext ), parallelExecution in Test := false, // javaOptions in Test ++= Seq( diff --git a/project/build.properties b/project/build.properties index 218101f1c..fc08caee5 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.3.2 +sbt.version = 1.4.4 diff --git a/project/plugins.sbt b/project/plugins.sbt index a27d92187..3d97eba5d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,7 +2,7 @@ addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") -addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.10") +addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.13") addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.3.0") diff --git a/scalapact-argonaut-6-2/src/main/scala/com/itv/scalapact/argonaut62/JsonConversionFunctions.scala b/scalapact-argonaut-6-2/src/main/scala/com/itv/scalapact/argonaut62/JsonConversionFunctions.scala index 654f46e7e..de5aaf5c9 100644 --- a/scalapact-argonaut-6-2/src/main/scala/com/itv/scalapact/argonaut62/JsonConversionFunctions.scala +++ b/scalapact-argonaut-6-2/src/main/scala/com/itv/scalapact/argonaut62/JsonConversionFunctions.scala @@ -23,9 +23,6 @@ object JsonConversionFunctions extends IJsonConversionFunctions { case j: Json if j.isObject => IrNode(label, jsonObjectToIrNodeList(j, pathToParent)).withPath(pathToParent) - case j: Json if j.isNull => - IrNode(label, IrNullNode).withPath(pathToParent) - case j: Json if j.isNumber => IrNode(label, j.number.flatMap(_.toDouble).map(d => IrNumberNode(d))).withPath(pathToParent) @@ -34,6 +31,9 @@ object JsonConversionFunctions extends IJsonConversionFunctions { case j: Json if j.isString => IrNode(label, j.string.map(IrStringNode)).withPath(pathToParent) + + case _ => + IrNode(label, IrNullNode).withPath(pathToParent) } private def jsonObjectToIrNodeList(json: Json, pathToParent: IrNodePath): List[IrNode] = diff --git a/scalapact-circe-0-13/src/main/scala/com/itv/scalapact/circe13/JsonConversionFunctions.scala b/scalapact-circe-0-13/src/main/scala/com/itv/scalapact/circe13/JsonConversionFunctions.scala index 1d2d418fd..536b090a5 100644 --- a/scalapact-circe-0-13/src/main/scala/com/itv/scalapact/circe13/JsonConversionFunctions.scala +++ b/scalapact-circe-0-13/src/main/scala/com/itv/scalapact/circe13/JsonConversionFunctions.scala @@ -24,9 +24,6 @@ object JsonConversionFunctions extends IJsonConversionFunctions { case j: Json if j.isObject => IrNode(label, jsonObjectToIrNodeList(j, pathToParent)).withPath(pathToParent) - case j: Json if j.isNull => - IrNode(label, IrNullNode).withPath(pathToParent) - case j: Json if j.isNumber => IrNode(label, j.asNumber.map(_.toDouble).map(d => IrNumberNode(d))).withPath(pathToParent) @@ -35,6 +32,9 @@ object JsonConversionFunctions extends IJsonConversionFunctions { case j: Json if j.isString => IrNode(label, j.asString.map(IrStringNode)).withPath(pathToParent) + + case _ => + IrNode(label, IrNullNode).withPath(pathToParent) } private def jsonObjectToIrNodeList(json: Json, pathToParent: IrNodePath): List[IrNode] = diff --git a/scalapact-scalatest/src/main/scala/com/itv/scalapact/model/ScalaPactDescription.scala b/scalapact-scalatest/src/main/scala/com/itv/scalapact/model/ScalaPactDescription.scala index 777a2dc71..45446c569 100644 --- a/scalapact-scalatest/src/main/scala/com/itv/scalapact/model/ScalaPactDescription.scala +++ b/scalapact-scalatest/src/main/scala/com/itv/scalapact/model/ScalaPactDescription.scala @@ -22,7 +22,7 @@ class ScalaPactDescription( * @return [ScalaPactDescription] to allow the builder to continue */ def addInteraction(interaction: ScalaPactInteraction): ScalaPactDescription = - new ScalaPactDescription(strict, consumer, provider, sslContextName, interactions :+ interaction) + new ScalaPactDescription(strict, consumer, provider, sslContextName, interaction :: interactions) def addSslContextForServer(name: String): ScalaPactDescription = new ScalaPactDescription(strict, consumer, provider, Some(name), interactions)