From 6b93d2a068c545ae83e00537cf3ad8b15ae1d6ee Mon Sep 17 00:00:00 2001 From: Vladimir Pavkin Date: Mon, 9 Dec 2019 11:34:00 +0300 Subject: [PATCH] Bump deps (#80) * Bump deps * fix --- .travis.yml | 4 +- build.sbt | 11 ++--- .../io/circe/magnolia/MagnoliaDecoder.scala | 4 +- project/plugins.sbt | 2 +- .../magnolia/SemiautoDerivedSuiteInputs.scala | 29 ++++++++------ ...guredSemiautoDerivedEquivalenceSuite.scala | 40 +++++++++---------- 6 files changed, 48 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index edeaa2c..c37c747 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ script: # See http://www.scala-sbt.org/0.13/docs/Travis-CI-with-sbt.html # Tricks to avoid unnecessary cache updates - - find $HOME/.sbt -name "*.lock" | xargs rm - - find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm + - find $HOME/.sbt -name "*.lock" | xargs -r rm + - find $HOME/.ivy2 -name "ivydata-*.properties" | xargs -r rm after_success: bash <(curl -s https://codecov.io/bash) diff --git a/build.sbt b/build.sbt index 1000f83..41ec674 100644 --- a/build.sbt +++ b/build.sbt @@ -3,7 +3,7 @@ import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} lazy val buildSettings = Seq( organization := "io.circe", - scalaVersion := "2.12.8" + scalaVersion := "2.12.10" ) def compilerOptions(compilerVersion: String) = Seq( @@ -55,12 +55,13 @@ def compilerOptions(compilerVersion: String) = Seq( "-Ywarn-unused:privates") else Seq.empty) -lazy val magnoliaVersion = "0.11.0" +lazy val magnoliaVersion = "0.12.2" lazy val mercatorVersion = "0.2.1" -lazy val circeVersion = "0.11.1" +lazy val circeVersion = "0.12.3" +lazy val circeGenericExtrasVersion = "0.12.2" lazy val shapelessVersion = "2.3.3" lazy val scalatestVersion = "3.0.8" -lazy val scalacheckVersion = "1.14.0" +lazy val scalacheckVersion = "1.14.2" lazy val compilerSettings = Seq( scalacOptions ++= compilerOptions(scalaVersion.value) ++ Seq("-Ywarn-macros:after"), @@ -79,7 +80,7 @@ lazy val testDependencies = libraryDependencies ++= Seq( "com.chuusai" %% "shapeless" % shapelessVersion, "io.circe" %%% "circe-parser" % circeVersion, "io.circe" %%% "circe-generic" % circeVersion, - "io.circe" %%% "circe-generic-extras" % circeVersion, + "io.circe" %%% "circe-generic-extras" % circeGenericExtrasVersion, "io.circe" %%% "circe-testing" % circeVersion, "org.scalacheck" %%% "scalacheck" % scalacheckVersion, "org.scalatest" %%% "scalatest" % scalatestVersion diff --git a/derivation/src/main/scala/io/circe/magnolia/MagnoliaDecoder.scala b/derivation/src/main/scala/io/circe/magnolia/MagnoliaDecoder.scala index 4dbd9db..56e1ebe 100644 --- a/derivation/src/main/scala/io/circe/magnolia/MagnoliaDecoder.scala +++ b/derivation/src/main/scala/io/circe/magnolia/MagnoliaDecoder.scala @@ -38,7 +38,7 @@ private[magnolia] object MagnoliaDecoder { // Some decoders (in particular, the default Option[T] decoder) do special things when a key is missing, // so we give them a chance to do their thing here. p.typeclass.tryDecode(keyCursor) - }(Right(_)) + }(Right(_): Either[DecodingFailure, p.PType]) } } } @@ -47,7 +47,7 @@ private[magnolia] object MagnoliaDecoder { else { new Decoder[T] { def apply(c: HCursor): Result[T] = { - caseClass.constructMonadic { p => + caseClass.constructMonadic { p => p.typeclass.tryDecode(c.downField(paramJsonKeyLookup.getOrElse(p.label, throw new IllegalStateException("Looking up a parameter label should always yield a value. This is a bug")))) } } diff --git a/project/plugins.sbt b/project/plugins.sbt index cc792a4..2f6643c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -8,7 +8,7 @@ addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2") addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12") -addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0") diff --git a/tests/src/test/scala/io/circe/magnolia/SemiautoDerivedSuiteInputs.scala b/tests/src/test/scala/io/circe/magnolia/SemiautoDerivedSuiteInputs.scala index f11c998..c16751e 100644 --- a/tests/src/test/scala/io/circe/magnolia/SemiautoDerivedSuiteInputs.scala +++ b/tests/src/test/scala/io/circe/magnolia/SemiautoDerivedSuiteInputs.scala @@ -10,16 +10,20 @@ object SemiautoDerivedSuiteInputs { sealed trait RecursiveAdtExample case class BaseAdtExample(a: String) extends RecursiveAdtExample - case class NestedAdtExample(r: RecursiveAdtExample) extends RecursiveAdtExample + case class NestedAdtExample(r: RecursiveAdtExample) + extends RecursiveAdtExample object RecursiveAdtExample { - implicit val eqRecursiveAdtExample: Eq[RecursiveAdtExample] = Eq.fromUniversalEquals + implicit val eqRecursiveAdtExample: Eq[RecursiveAdtExample] = + Eq.fromUniversalEquals - private def atDepth(depth: Int): Gen[RecursiveAdtExample] = if (depth < 3) - Gen.oneOf( - Arbitrary.arbitrary[String].map(BaseAdtExample(_)), - atDepth(depth + 1).map(NestedAdtExample(_)) - ) else Arbitrary.arbitrary[String].map(BaseAdtExample(_)) + private def atDepth(depth: Int): Gen[RecursiveAdtExample] = + if (depth < 3) + Gen.oneOf( + Arbitrary.arbitrary[String].map(BaseAdtExample(_)), + atDepth(depth + 1).map(NestedAdtExample(_)) + ) + else Arbitrary.arbitrary[String].map(BaseAdtExample(_)) implicit val arbitraryRecursiveAdtExample: Arbitrary[RecursiveAdtExample] = Arbitrary(atDepth(0)) @@ -31,12 +35,13 @@ object SemiautoDerivedSuiteInputs { implicit val eqRecursiveWithOptionExample: Eq[RecursiveWithOptionExample] = Eq.fromUniversalEquals - private def atDepth(depth: Int): Gen[RecursiveWithOptionExample] = if (depth < 3) - Arbitrary.arbitrary[Option[RecursiveWithOptionExample]].map( - RecursiveWithOptionExample(_) - ) else Gen.const(RecursiveWithOptionExample(None)) + private def atDepth(depth: Int): Gen[RecursiveWithOptionExample] = + if (depth < 3) + Gen.option(atDepth(depth + 1)).map(RecursiveWithOptionExample(_)) + else Gen.const(RecursiveWithOptionExample(None)) - implicit val arbitraryRecursiveWithOptionExample: Arbitrary[RecursiveWithOptionExample] = + implicit val arbitraryRecursiveWithOptionExample + : Arbitrary[RecursiveWithOptionExample] = Arbitrary(atDepth(0)) } diff --git a/tests/src/test/scala/io/circe/magnolia/configured/ConfiguredSemiautoDerivedEquivalenceSuite.scala b/tests/src/test/scala/io/circe/magnolia/configured/ConfiguredSemiautoDerivedEquivalenceSuite.scala index 80eb986..25d6c30 100644 --- a/tests/src/test/scala/io/circe/magnolia/configured/ConfiguredSemiautoDerivedEquivalenceSuite.scala +++ b/tests/src/test/scala/io/circe/magnolia/configured/ConfiguredSemiautoDerivedEquivalenceSuite.scala @@ -55,49 +55,49 @@ class ConfiguredSemiautoDerivedEquivalenceSuite extends CirceSuite { } private class CirceCodecs(config: GeConfiguration) { - import io.circe.generic.extras.semiauto.{deriveEncoder, deriveDecoder} + import io.circe.generic.extras.semiauto.{deriveConfiguredEncoder, deriveConfiguredDecoder} implicit val configuration: GeConfiguration = config - implicit val circeEncoder1: TaggedEncoder[Circe, AnyValInside] = mkTag[Circe](deriveEncoder[AnyValInside]) - implicit val circeEncoder3: TaggedEncoder[Circe, Box[Int]] = mkTag[Circe](deriveEncoder[Box[Int]]) - implicit val circeEncoder4: TaggedEncoder[Circe, Qux[Int]] = mkTag[Circe](deriveEncoder[Qux[Int]]) - implicit val circeEncoder6: TaggedEncoder[Circe, Baz] = mkTag[Circe](deriveEncoder[Baz]) + implicit val circeEncoder1: TaggedEncoder[Circe, AnyValInside] = mkTag[Circe](deriveConfiguredEncoder[AnyValInside]) + implicit val circeEncoder3: TaggedEncoder[Circe, Box[Int]] = mkTag[Circe](deriveConfiguredEncoder[Box[Int]]) + implicit val circeEncoder4: TaggedEncoder[Circe, Qux[Int]] = mkTag[Circe](deriveConfiguredEncoder[Qux[Int]]) + implicit val circeEncoder6: TaggedEncoder[Circe, Baz] = mkTag[Circe](deriveConfiguredEncoder[Baz]) private implicit val encodeFoo: Encoder[Foo] = { // Circe does not automatically derive instances for subtypes implicit val encodeBar = Bar.encodeBar implicit val encodeBam = Bam.encodeBam - deriveEncoder[Foo] + deriveConfiguredEncoder[Foo] } implicit val circeEncoder7: TaggedEncoder[Circe, Foo] = { mkTag[Circe](encodeFoo) } implicit val circeEncoderSeqFoo: TaggedEncoder[Circe, Seq[Foo]] = mkTag[Circe](Encoder.encodeSeq(encodeFoo)) - implicit val circeEncoderSealed: TaggedEncoder[Circe, Sealed] = mkTag[Circe](deriveEncoder[Sealed]) - private implicit val encodeRecursiveAdtExample: Encoder[RecursiveAdtExample] = deriveEncoder[RecursiveAdtExample] + implicit val circeEncoderSealed: TaggedEncoder[Circe, Sealed] = mkTag[Circe](deriveConfiguredEncoder[Sealed]) + private implicit val encodeRecursiveAdtExample: Encoder[RecursiveAdtExample] = deriveConfiguredEncoder[RecursiveAdtExample] implicit val circeEncoder8: TaggedEncoder[Circe, RecursiveAdtExample] = mkTag[Circe](encodeRecursiveAdtExample) - private implicit val encodeRecursiveWithOptionExample: Encoder[RecursiveWithOptionExample] = deriveEncoder[RecursiveWithOptionExample] + private implicit val encodeRecursiveWithOptionExample: Encoder[RecursiveWithOptionExample] = deriveConfiguredEncoder[RecursiveWithOptionExample] implicit val circeEncoder9: TaggedEncoder[Circe, RecursiveWithOptionExample] = mkTag[Circe](encodeRecursiveWithOptionExample) - implicit val circeEncoder13: TaggedEncoder[Circe, ClassWithDefaults] = mkTag[Circe](deriveEncoder[ClassWithDefaults]) - implicit val circeEncoder14: TaggedEncoder[Circe, ClassWithJsonKey] = mkTag[Circe](deriveEncoder[ClassWithJsonKey]) + implicit val circeEncoder13: TaggedEncoder[Circe, ClassWithDefaults] = mkTag[Circe](deriveConfiguredEncoder[ClassWithDefaults]) + implicit val circeEncoder14: TaggedEncoder[Circe, ClassWithJsonKey] = mkTag[Circe](deriveConfiguredEncoder[ClassWithJsonKey]) - implicit val circeDecoder1: TaggedDecoder[Circe, AnyValInside] = mkTag[Circe](deriveDecoder[AnyValInside]) - implicit val circeDecoder3: TaggedDecoder[Circe, Qux[Int]] = mkTag[Circe](deriveDecoder[Qux[Int]]) - implicit val circeDecoder5: TaggedDecoder[Circe, Baz] = mkTag[Circe](deriveDecoder[Baz]) + implicit val circeDecoder1: TaggedDecoder[Circe, AnyValInside] = mkTag[Circe](deriveConfiguredDecoder[AnyValInside]) + implicit val circeDecoder3: TaggedDecoder[Circe, Qux[Int]] = mkTag[Circe](deriveConfiguredDecoder[Qux[Int]]) + implicit val circeDecoder5: TaggedDecoder[Circe, Baz] = mkTag[Circe](deriveConfiguredDecoder[Baz]) private implicit val decodeFoo: Decoder[Foo] = { implicit val decodeBar = Bar.decodeBar implicit val decodeBam = Bam.decodeBam - deriveDecoder[Foo] + deriveConfiguredDecoder[Foo] } implicit val circeDecoder6: TaggedDecoder[Circe, Foo] = mkTag[Circe](decodeFoo) implicit val circeDecoder4: TaggedDecoder[Circe, Seq[Foo]] = mkTag[Circe](Decoder.decodeSeq(circeDecoder6.inner)) - implicit val circeDecoderSealed: TaggedDecoder[Circe, Sealed] = mkTag[Circe](deriveDecoder[Sealed]) - private implicit val decodeRecursiveAdtExample: Decoder[RecursiveAdtExample] = deriveDecoder[RecursiveAdtExample] + implicit val circeDecoderSealed: TaggedDecoder[Circe, Sealed] = mkTag[Circe](deriveConfiguredDecoder[Sealed]) + private implicit val decodeRecursiveAdtExample: Decoder[RecursiveAdtExample] = deriveConfiguredDecoder[RecursiveAdtExample] implicit val circeDecoder8: TaggedDecoder[Circe, RecursiveAdtExample] = mkTag[Circe](decodeRecursiveAdtExample) - private implicit val decodeRecursiveWithOptionExample: Decoder[RecursiveWithOptionExample] = deriveDecoder[RecursiveWithOptionExample] + private implicit val decodeRecursiveWithOptionExample: Decoder[RecursiveWithOptionExample] = deriveConfiguredDecoder[RecursiveWithOptionExample] implicit val circeDecoder9: TaggedDecoder[Circe, RecursiveWithOptionExample] = mkTag[Circe](decodeRecursiveWithOptionExample) - implicit val circeDecoder13: TaggedDecoder[Circe, ClassWithDefaults] = mkTag[Circe](deriveDecoder[ClassWithDefaults]) - implicit val circeDecoder14: TaggedDecoder[Circe, ClassWithJsonKey] = mkTag[Circe](deriveDecoder[ClassWithJsonKey]) + implicit val circeDecoder13: TaggedDecoder[Circe, ClassWithDefaults] = mkTag[Circe](deriveConfiguredDecoder[ClassWithDefaults]) + implicit val circeDecoder14: TaggedDecoder[Circe, ClassWithJsonKey] = mkTag[Circe](deriveConfiguredDecoder[ClassWithJsonKey]) } def testWithConfiguration(postfix: String, configuration: Configuration): Unit = {