From 62402278aac338f801a75242a2f5d72be5972945 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Mon, 24 Jun 2024 14:18:42 +0200 Subject: [PATCH 01/10] Add dependencies --- .scalafmt.conf | 18 +++++++- build.sbt | 94 ++++++++++++++++++++-------------------- project/build.properties | 2 +- project/plugins.sbt | 10 +---- scalastyle-config.xml | 85 ------------------------------------ version.sbt | 1 - 6 files changed, 66 insertions(+), 144 deletions(-) delete mode 100644 scalastyle-config.xml delete mode 100644 version.sbt diff --git a/.scalafmt.conf b/.scalafmt.conf index cfad99bd..47317d54 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,6 +1,10 @@ -version = 3.5.9 +version = 3.8.2 +project.git = true +runner.dialect = scala213 +project.layout = StandardConvention continuationIndent.defnSite = 2 -docstrings = JavaDoc +docstrings.style = Asterisk +docstrings.wrap = no includeCurlyBraceInSelectChains = false maxColumn = 120 newlines.alwaysBeforeElseAfterCurlyIf = false @@ -13,3 +17,13 @@ rewrite.rules = [ AsciiSortImports, PreferCurlyFors ] +newlines.afterCurlyLambda = preserve +newlines.beforeCurlyLambdaParams = multilineWithCaseOnly + +fileOverride { + "glob:**/scala-3/src/main/scala/**" { + runner.dialect = scala3 + rewrite.scala3.convertToNewSyntax = true + rewrite.scala3.removeOptionalBraces = true + } +} \ No newline at end of file diff --git a/build.sbt b/build.sbt index 7739df3a..0c6086aa 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,10 @@ ThisBuild / organization := "io.circe" -ThisBuild / crossScalaVersions := Seq("2.13.10", "2.12.17", "3.2.2") +ThisBuild / crossScalaVersions := Seq("2.13.14", "2.12.19", "3.3.3") ThisBuild / scalaVersion := crossScalaVersions.value.head ThisBuild / githubWorkflowPublishTargetBranches := Nil +ThisBuild / startYear := Some(2016) +ThisBuild / tlBaseVersion := "0.14" + val compilerOptions = Seq( "-deprecation", @@ -15,10 +18,10 @@ val compilerOptions = Seq( "-Ywarn-numeric-widen" ) -val circeVersion = "0.14.1" -val munitVersion = "0.7.26" -val previousCirceJacksonVersion = "0.13.0" -val disciplineMunitVersion = "1.0.9" +val circeVersion = "0.14.8" +val munitVersion = "1.0.0" +val previousCirceJacksonVersion = "0.14.0" +val disciplineMunitVersion = "2.0.0" def priorTo2_13(scalaVersion: String): Boolean = CrossVersion.partialVersion(scalaVersion) match { @@ -46,13 +49,10 @@ val baseSettings = Seq( Test / console / scalacOptions ~= { _.filterNot(Set("-Ywarn-unused-import")) }, - resolvers ++= Seq( - Resolver.sonatypeRepo("releases"), - Resolver.sonatypeRepo("snapshots") - ), + resolvers ++= Resolver.sonatypeOssRepos("releases"), + resolvers ++= Resolver.sonatypeOssRepos("snapshots"), coverageHighlighting := true, coverageEnabled := (if (scalaVersion.value.startsWith("3")) false else coverageEnabled.value), - (Compile / scalastyleSources) ++= (Compile / unmanagedSourceDirectories).value, libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion, "io.circe" %% "circe-jawn" % circeVersion % Test, @@ -62,7 +62,6 @@ val baseSettings = Seq( Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "shared/src/main", Test / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "shared/src/test", Test / unmanagedResourceDirectories += (ThisBuild / baseDirectory).value / "shared/src/test/resources", - testFrameworks += new TestFramework("munit.Framework"), Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.AllLibraryJars ) @@ -112,14 +111,10 @@ lazy val jackson27 = project lazy val jackson28 = project .in(file("28")) - .enablePlugins(GhpagesPlugin) .settings(allSettings) .settings( moduleName := "circe-jackson28", libraryDependencies ++= jacksonDependencies("2.8.11", Some("2.8.11.6")), - docMappingsApiDir := "api", - addMappingsToSiteDir(Compile / packageDoc / mappings, docMappingsApiDir), - ghpagesNoJekyll := true, Compile / doc / scalacOptions ++= Seq( "-groups", "-implicits", @@ -167,7 +162,7 @@ lazy val jackson212 = project .settings(allSettings) .settings( moduleName := "circe-jackson212", - libraryDependencies ++= jacksonDependencies("2.12.5"), + libraryDependencies ++= jacksonDependencies("2.12.7"), Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" ) @@ -176,7 +171,42 @@ lazy val jackson213 = project .settings(allSettings) .settings( moduleName := "circe-jackson213", - libraryDependencies ++= jacksonDependencies("2.13.0"), + libraryDependencies ++= jacksonDependencies("2.13.5"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + ) + +lazy val jackson214 = project + .in(file("214")) + .settings(allSettings) + .settings( + moduleName := "circe-jackson214", + libraryDependencies ++= jacksonDependencies("2.14.3"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + ) +lazy val jackson215 = project + .in(file("215")) + .settings(allSettings) + .settings( + moduleName := "circe-jackson215", + libraryDependencies ++= jacksonDependencies("2.15.4"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + ) + +lazy val jackson216 = project + .in(file("216")) + .settings(allSettings) + .settings( + moduleName := "circe-jackson216", + libraryDependencies ++= jacksonDependencies("2.16.2"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + ) + +lazy val jackson217 = project + .in(file("217")) + .settings(allSettings) + .settings( + moduleName := "circe-jackson217", + libraryDependencies ++= jacksonDependencies("2.17.1"), Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" ) @@ -193,7 +223,7 @@ lazy val benchmark = project ) ) .enablePlugins(JmhPlugin) - .dependsOn(jackson213) + .dependsOn(jackson217) lazy val noPublishSettings = Seq( publish := {}, @@ -202,27 +232,10 @@ lazy val noPublishSettings = Seq( ) lazy val publishSettings = Seq( - releaseCrossBuild := true, - releasePublishArtifactsAction := PgpKeys.publishSigned.value, - releaseVcsSign := true, homepage := Some(url("https://github.com/circe/circe-jackson")), - licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), publishMavenStyle := true, Test / publishArtifact := false, pomIncludeRepository := { _ => false }, - publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isSnapshot.value) - Some("snapshots".at(nexus + "content/repositories/snapshots")) - else - Some("releases".at(nexus + "service/local/staging/deploy/maven2")) - }, - scmInfo := Some( - ScmInfo( - url("https://github.com/circe/circe-jackson"), - "scm:git:git@github.com:circe/circe-jackson.git" - ) - ), developers := List( Developer( "travisbrown", @@ -233,14 +246,3 @@ lazy val publishSettings = Seq( ) ) -credentials ++= ( - for { - username <- Option(System.getenv().get("SONATYPE_USERNAME")) - password <- Option(System.getenv().get("SONATYPE_PASSWORD")) - } yield Credentials( - "Sonatype Nexus Repository Manager", - "oss.sonatype.org", - username, - password - ) -).toSeq diff --git a/project/build.properties b/project/build.properties index 72413de1..081fdbbc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.3 +sbt.version=1.10.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index 45559bac..5e1d489d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,11 +1,3 @@ -addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0") -addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3") -addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") -addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") -addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") +addSbtPlugin("io.circe" % "sbt-circe-org" % "0.4.1") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") diff --git a/scalastyle-config.xml b/scalastyle-config.xml deleted file mode 100644 index ee8b24d7..00000000 --- a/scalastyle-config.xml +++ /dev/null @@ -1,85 +0,0 @@ - - Circe Configuration - - - FOR - IF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - all - .+ - - - diff --git a/version.sbt b/version.sbt deleted file mode 100644 index f3d98ff2..00000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -ThisBuild / version := "0.14.1-SNAPSHOT" From 93a6f900dc0ca1c004c66c2307c357b152a21437 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Mon, 24 Jun 2024 14:19:18 +0200 Subject: [PATCH 02/10] run Scalafmt --- .../scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala | 2 +- .../io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala | 2 +- .../src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala | 2 +- .../src/main/scala/io/circe/jackson/CirceJsonSerializer.scala | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala b/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala index 881baa47..ede950a4 100644 --- a/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala +++ b/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala @@ -2,7 +2,7 @@ package io.circe.jackson.benchmark import cats.instances.AllInstances import io.circe.testing.{ ArbitraryInstances, EqInstances } -import cats.syntax.{ AllSyntax } +import cats.syntax.AllSyntax class ParsingBenchmarkSpec extends munit.FunSuite diff --git a/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala b/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala index eae08547..57c4b185 100644 --- a/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala +++ b/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala @@ -2,7 +2,7 @@ package io.circe.jackson.benchmark import cats.instances.AllInstances import io.circe.testing.{ ArbitraryInstances, EqInstances } -import cats.syntax.{ AllSyntax } +import cats.syntax.AllSyntax import io.circe.parser.decode import java.nio.ByteBuffer diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala index d0325ae1..7b44eccd 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala @@ -72,7 +72,7 @@ private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: case JsonTokenId.ID_FIELD_NAME => parserContext match { case (c: ReadingMap) :: stack => (None, c.setField(jp.getCurrentName) +: stack) - case _ => throw new RuntimeException("We weren't reading an object, something went wrong") + case _ => throw new RuntimeException("We weren't reading an object, something went wrong") } case JsonTokenId.ID_END_OBJECT => diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala index 1f2d294b..c715fc02 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala @@ -26,7 +26,7 @@ private[jackson] final object CirceJsonSerializer extends JsonSerializer[Json] { // configuration is ignored when called from ObjectMapper.valueToTree val raw = x.stripTrailingZeros.toPlainString - if (raw contains ".") json.writeTree(new DecimalNode(new JBigDecimal(raw))) + if (raw.contains(".")) json.writeTree(new DecimalNode(new JBigDecimal(raw))) else json.writeTree(new BigIntegerNode(new BigInteger(raw))) } case Json.JString(v) => json.writeString(v) From bfdfc77dd645f329ffcb2c946ec620bbf24ef7e9 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Mon, 24 Jun 2024 14:23:01 +0200 Subject: [PATCH 03/10] formatting and generate workflow --- .github/workflows/ci.yml | 124 ++++++++++++++++++++++++++++++++------- build.sbt | 19 +++++- 2 files changed, 119 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4898c3e8..6697c995 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,47 +9,129 @@ name: Continuous Integration on: pull_request: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] push: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] + tags: [v*] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }} @ ${{ github.ref }} + cancel-in-progress: true + jobs: build: name: Build and Test strategy: matrix: os: [ubuntu-latest] - scala: [2.13.10, 2.12.17, 3.2.2] - java: [adopt@1.8] + scala: [2.13, 2.12, 3] + java: [temurin@11, temurin@17] + exclude: + - scala: 2.12 + java: temurin@17 + - scala: 3 + java: temurin@17 runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v13 + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 with: - java-version: ${{ matrix.java }} + distribution: temurin + java-version: 11 + cache: sbt - - name: Cache sbt - uses: actions/cache@v2 + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update + + - name: Setup Java (temurin@17) + id: setup-java-temurin-17 + if: matrix.java == 'temurin@17' + uses: actions/setup-java@v4 with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + distribution: temurin + java-version: 17 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update - name: Check that workflows are up to date - run: sbt ++${{ matrix.scala }} githubWorkflowCheck + run: sbt githubWorkflowCheck + + - name: Check headers and formatting + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck + + - name: Check scalafix lints + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' 'scalafixAll --check' + + - name: Test + run: sbt '++ ${{ matrix.scala }}' test - - name: Build project - run: sbt ++${{ matrix.scala }} test + - name: Check binary compatibility + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues + + - name: Generate API documentation + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' doc + + dependency-submission: + name: Submit Dependencies + if: github.event_name != 'pull_request' + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@11] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update + + - name: Setup Java (temurin@17) + id: setup-java-temurin-17 + if: matrix.java == 'temurin@17' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update + + - name: Submit Dependencies + uses: scalacenter/sbt-dependency-submission@v2 + with: + configs-ignore: test scala-tool scala-doc-tool test-internal diff --git a/build.sbt b/build.sbt index 0c6086aa..60401da8 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,6 @@ ThisBuild / githubWorkflowPublishTargetBranches := Nil ThisBuild / startYear := Some(2016) ThisBuild / tlBaseVersion := "0.14" - val compilerOptions = Seq( "-deprecation", "-encoding", @@ -78,7 +77,22 @@ val allSettings = baseSettings ++ publishSettings val root = project .in(file(".")) .settings(allSettings ++ noPublishSettings) - .aggregate(jackson25, jackson26, jackson27, jackson28, jackson29, jackson210, jackson211, jackson212, jackson213, benchmark) + .aggregate( + jackson26, + jackson26, + jackson27, + jackson28, + jackson29, + jackson210, + jackson211, + jackson212, + jackson213, + jackson214, + jackson215, + jackson216, + jackson217, + benchmark + ) .dependsOn(jackson210) lazy val jackson25 = project @@ -245,4 +259,3 @@ lazy val publishSettings = Seq( ) ) ) - From 3b754574ef25ade4f8937c93f845dac05082a4ee Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Mon, 24 Jun 2024 14:34:39 +0200 Subject: [PATCH 04/10] Add headers --- .../scala/io/circe/jackson/JacksonCompat.scala | 16 ++++++++++++++++ .../scala/io/circe/jackson/JacksonCompat.scala | 16 ++++++++++++++++ .../scala/io/circe/jackson/JacksonCompat.scala | 16 ++++++++++++++++ .../io/circe/jackson/benchmark/Benchmark.scala | 16 ++++++++++++++++ .../jackson/benchmark/ParsingBenchmarkSpec.scala | 16 ++++++++++++++++ .../benchmark/PrintingBenchmarkSpec.scala | 16 ++++++++++++++++ .../io/circe/jackson/CirceJsonDeserializer.scala | 16 ++++++++++++++++ .../scala/io/circe/jackson/CirceJsonModule.scala | 16 ++++++++++++++++ .../io/circe/jackson/CirceJsonSerializer.scala | 16 ++++++++++++++++ .../scala/io/circe/jackson/JacksonParser.scala | 16 ++++++++++++++++ .../io/circe/jackson/WithJacksonMapper.scala | 16 ++++++++++++++++ .../main/scala/io/circe/jackson/package.scala | 16 ++++++++++++++++ .../scala/io/circe/jackson/syntax/package.scala | 16 ++++++++++++++++ .../test/scala/io/circe/jackson/CirceSuite.scala | 16 ++++++++++++++++ .../scala/io/circe/jackson/ConvertingSuite.scala | 16 ++++++++++++++++ .../io/circe/jackson/JacksonInstances.scala | 16 ++++++++++++++++ .../io/circe/jackson/JacksonParserSuite.scala | 16 ++++++++++++++++ .../io/circe/jackson/JacksonPrintingSuite.scala | 16 ++++++++++++++++ 18 files changed, 288 insertions(+) diff --git a/210/src/main/scala/io/circe/jackson/JacksonCompat.scala b/210/src/main/scala/io/circe/jackson/JacksonCompat.scala index a10a89f9..060a0a54 100644 --- a/210/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/210/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.JsonParser diff --git a/27/src/main/scala/io/circe/jackson/JacksonCompat.scala b/27/src/main/scala/io/circe/jackson/JacksonCompat.scala index a7ef0750..663ad825 100644 --- a/27/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/27/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.JsonParser diff --git a/28/src/main/scala/io/circe/jackson/JacksonCompat.scala b/28/src/main/scala/io/circe/jackson/JacksonCompat.scala index d1100338..eb853673 100644 --- a/28/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/28/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.JsonParser diff --git a/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala b/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala index eedd5425..22ed0d03 100644 --- a/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala +++ b/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson.benchmark import cats.Eq diff --git a/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala b/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala index ede950a4..66bce74c 100644 --- a/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala +++ b/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson.benchmark import cats.instances.AllInstances diff --git a/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala b/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala index 57c4b185..266b4449 100644 --- a/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala +++ b/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson.benchmark import cats.instances.AllInstances diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala index 7b44eccd..06a82c77 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.{ JsonParser, JsonTokenId } diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala index 0e73f0b8..4b79cc23 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.Version diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala index c715fc02..ffad6b67 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.JsonGenerator diff --git a/shared/src/main/scala/io/circe/jackson/JacksonParser.scala b/shared/src/main/scala/io/circe/jackson/JacksonParser.scala index a7a8bafc..4bf4559a 100644 --- a/shared/src/main/scala/io/circe/jackson/JacksonParser.scala +++ b/shared/src/main/scala/io/circe/jackson/JacksonParser.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import cats.data.ValidatedNel diff --git a/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala b/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala index c0b72d02..a5ddcd52 100644 --- a/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala +++ b/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.{ JsonFactory, JsonParser } diff --git a/shared/src/main/scala/io/circe/jackson/package.scala b/shared/src/main/scala/io/circe/jackson/package.scala index 5f922a5c..4efa34af 100644 --- a/shared/src/main/scala/io/circe/jackson/package.scala +++ b/shared/src/main/scala/io/circe/jackson/package.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe import com.fasterxml.jackson.databind.JsonNode diff --git a/shared/src/main/scala/io/circe/jackson/syntax/package.scala b/shared/src/main/scala/io/circe/jackson/syntax/package.scala index 60ee523f..3df85196 100644 --- a/shared/src/main/scala/io/circe/jackson/syntax/package.scala +++ b/shared/src/main/scala/io/circe/jackson/syntax/package.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import io.circe.Json diff --git a/shared/src/test/scala/io/circe/jackson/CirceSuite.scala b/shared/src/test/scala/io/circe/jackson/CirceSuite.scala index 1431746d..23be3ca6 100644 --- a/shared/src/test/scala/io/circe/jackson/CirceSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/CirceSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import cats.instances.AllInstances diff --git a/shared/src/test/scala/io/circe/jackson/ConvertingSuite.scala b/shared/src/test/scala/io/circe/jackson/ConvertingSuite.scala index e9cd08a9..f1ea589f 100644 --- a/shared/src/test/scala/io/circe/jackson/ConvertingSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/ConvertingSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import org.scalacheck.Prop diff --git a/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala b/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala index 8d3ef3f4..725356f7 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import cats.Eq diff --git a/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala b/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala index 3c245e38..20bb1733 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import cats.data.Validated diff --git a/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala b/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala index ee0bec42..29c75604 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import io.circe.Json From 7a9e6135ef9bc808e50994878a9c6413974a823d Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Mon, 24 Jun 2024 15:17:57 +0200 Subject: [PATCH 05/10] run scalafixAll, and fix warnings --- .github/workflows/ci.yml | 4 -- .gitignore | 2 + .scalafix.conf | 3 ++ .../io/circe/jackson/JacksonCompat.scala | 11 ++++- .../io/circe/jackson/JacksonCompat.scala | 3 ++ .../io/circe/jackson/JacksonCompat.scala | 12 ++++- .../io/circe/jackson/JacksonCompat.scala | 11 ++++- .../circe/jackson/benchmark/Benchmark.scala | 12 ++++- .../benchmark/ParsingBenchmarkSpec.scala | 3 +- .../benchmark/PrintingBenchmarkSpec.scala | 4 +- build.sbt | 45 +++++-------------- project/plugins.sbt | 1 + .../circe/jackson/CirceJsonDeserializer.scala | 32 ++++++++----- .../io/circe/jackson/CirceJsonModule.scala | 14 +++--- .../circe/jackson/CirceJsonSerializer.scala | 13 ++++-- .../io/circe/jackson/JacksonParser.scala | 7 ++- .../io/circe/jackson/WithJacksonMapper.scala | 7 ++- .../main/scala/io/circe/jackson/package.scala | 25 ++++++----- .../scala/io/circe/jackson/CirceSuite.scala | 7 +-- .../io/circe/jackson/JacksonInstances.scala | 22 ++++++--- .../io/circe/jackson/JacksonParserSuite.scala | 9 ++-- .../circe/jackson/JacksonPrintingSuite.scala | 3 +- 22 files changed, 155 insertions(+), 95 deletions(-) create mode 100644 .scalafix.conf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6697c995..e3d444b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,10 +76,6 @@ jobs: if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck - - name: Check scalafix lints - if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' - run: sbt '++ ${{ matrix.scala }}' 'scalafixAll --check' - - name: Test run: sbt '++ ${{ matrix.scala }}' test diff --git a/.gitignore b/.gitignore index 495d8365..4c584c9d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ target/ .classpath tmp/ .bsp/ +.metals +.vscode diff --git a/.scalafix.conf b/.scalafix.conf new file mode 100644 index 00000000..edf55aee --- /dev/null +++ b/.scalafix.conf @@ -0,0 +1,3 @@ +rules = [ + OrganizeImports +] diff --git a/210/src/main/scala/io/circe/jackson/JacksonCompat.scala b/210/src/main/scala/io/circe/jackson/JacksonCompat.scala index 060a0a54..ebf0e7bc 100644 --- a/210/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/210/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -17,7 +17,10 @@ package io.circe.jackson import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.{ DeserializationContext, JsonNode, ObjectMapper, ObjectWriter } +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectWriter import com.fasterxml.jackson.databind.node.ObjectNode private[jackson] trait JacksonCompat { @@ -26,9 +29,13 @@ private[jackson] trait JacksonCompat { protected def handleUnexpectedToken(context: DeserializationContext)( klass: Class[_], parser: JsonParser - ): Unit = + ): Unit = { context.handleUnexpectedToken(klass, parser) + () + } protected def objectNodeSetAll(node: ObjectNode, fields: java.util.Map[String, JsonNode]): JsonNode = node.setAll[JsonNode](fields) + + protected def currentName(jp: JsonParser): String = jp.currentName } diff --git a/25/src/main/scala/io/circe/jackson/JacksonCompat.scala b/25/src/main/scala/io/circe/jackson/JacksonCompat.scala index 198b93d7..0533f6e4 100644 --- a/25/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/25/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -15,4 +15,7 @@ private[jackson] trait JacksonCompat { protected def objectNodeSetAll(node: ObjectNode, fields: java.util.Map[String, JsonNode]): JsonNode = node.setAll(fields) + + protected def currentName(jp: JsonParser): String = jp.getCurrentName + } diff --git a/27/src/main/scala/io/circe/jackson/JacksonCompat.scala b/27/src/main/scala/io/circe/jackson/JacksonCompat.scala index 663ad825..61a3b56e 100644 --- a/27/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/27/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -17,7 +17,10 @@ package io.circe.jackson import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.{ DeserializationContext, JsonNode, ObjectMapper, ObjectWriter } +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectWriter import com.fasterxml.jackson.databind.node.ObjectNode private[jackson] trait JacksonCompat { @@ -26,9 +29,14 @@ private[jackson] trait JacksonCompat { protected def handleUnexpectedToken(context: DeserializationContext)( klass: Class[_], parser: JsonParser - ): Unit = + ): Unit = { + val _ = parser throw context.mappingException(klass) + } protected def objectNodeSetAll(node: ObjectNode, fields: java.util.Map[String, JsonNode]): JsonNode = node.setAll(fields) + + protected def currentName(jp: JsonParser): String = jp.getCurrentName + } diff --git a/28/src/main/scala/io/circe/jackson/JacksonCompat.scala b/28/src/main/scala/io/circe/jackson/JacksonCompat.scala index eb853673..8514f3ad 100644 --- a/28/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/28/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -17,7 +17,10 @@ package io.circe.jackson import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.{ DeserializationContext, JsonNode, ObjectMapper, ObjectWriter } +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectWriter import com.fasterxml.jackson.databind.node.ObjectNode private[jackson] trait JacksonCompat { @@ -26,9 +29,13 @@ private[jackson] trait JacksonCompat { protected def handleUnexpectedToken(context: DeserializationContext)( klass: Class[_], parser: JsonParser - ): Unit = + ): Unit = { context.handleUnexpectedToken(klass, parser) + () + } protected def objectNodeSetAll(node: ObjectNode, fields: java.util.Map[String, JsonNode]): JsonNode = node.setAll(fields) + + protected def currentName(jp: JsonParser): String = jp.getCurrentName } diff --git a/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala b/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala index 22ed0d03..2e367140 100644 --- a/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala +++ b/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala @@ -17,12 +17,16 @@ package io.circe.jackson.benchmark import cats.Eq -import io.circe.{ Decoder, Encoder, Json => JsonC } +import io.circe.Decoder +import io.circe.Encoder import io.circe.generic.semiauto._ import io.circe.jawn._ +import io.circe.{ Json => JsonC } +import org.openjdk.jmh.annotations._ + import java.nio.ByteBuffer import java.util.concurrent.TimeUnit -import org.openjdk.jmh.annotations._ +import scala.annotation.nowarn case class Foo(s: String, d: Double, i: Int, l: Long, bs: List[Boolean]) @@ -62,15 +66,19 @@ class ExampleData { @OutputTimeUnit(TimeUnit.SECONDS) class ParsingBenchmark extends ExampleData { @Benchmark + @nowarn("cat=deprecation") def parseIntsC: JsonC = parse(intsJson).right.getOrElse(throw new Exception) @Benchmark + @nowarn("cat=deprecation") def parseIntsCJ: JsonC = io.circe.jackson.parse(intsJson).right.getOrElse(throw new Exception) @Benchmark + @nowarn("cat=deprecation") def parseFoosC: JsonC = parse(foosJson).right.getOrElse(throw new Exception) @Benchmark + @nowarn("cat=deprecation") def parseFoosCJ: JsonC = io.circe.jackson.parse(foosJson).right.getOrElse(throw new Exception) } diff --git a/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala b/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala index 66bce74c..a7d1b3b9 100644 --- a/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala +++ b/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala @@ -17,8 +17,9 @@ package io.circe.jackson.benchmark import cats.instances.AllInstances -import io.circe.testing.{ ArbitraryInstances, EqInstances } import cats.syntax.AllSyntax +import io.circe.testing.ArbitraryInstances +import io.circe.testing.EqInstances class ParsingBenchmarkSpec extends munit.FunSuite diff --git a/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala b/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala index 266b4449..66d4bc07 100644 --- a/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala +++ b/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala @@ -17,9 +17,11 @@ package io.circe.jackson.benchmark import cats.instances.AllInstances -import io.circe.testing.{ ArbitraryInstances, EqInstances } import cats.syntax.AllSyntax import io.circe.parser.decode +import io.circe.testing.ArbitraryInstances +import io.circe.testing.EqInstances + import java.nio.ByteBuffer class PrintingBenchmarkSpec diff --git a/build.sbt b/build.sbt index 60401da8..abf6c395 100644 --- a/build.sbt +++ b/build.sbt @@ -3,19 +3,11 @@ ThisBuild / crossScalaVersions := Seq("2.13.14", "2.12.19", "3.3.3") ThisBuild / scalaVersion := crossScalaVersions.value.head ThisBuild / githubWorkflowPublishTargetBranches := Nil ThisBuild / startYear := Some(2016) -ThisBuild / tlBaseVersion := "0.14" - -val compilerOptions = Seq( - "-deprecation", - "-encoding", - "UTF-8", - "-feature", - "-language:existentials", - "-language:higherKinds", - "-unchecked", - "-Ywarn-dead-code", - "-Ywarn-numeric-widen" -) +ThisBuild / tlBaseVersion := "0.15" +ThisBuild / scalafixAll / skip := tlIsScala3.value +ThisBuild / ScalafixConfig / skip := tlIsScala3.value +ThisBuild / tlCiScalafixCheck := false // TODO: Address these in a follow up PR +ThisBuild / tlFatalWarnings := false // TODO: fix by dropping 2.12 val circeVersion = "0.14.8" val munitVersion = "1.0.0" @@ -29,34 +21,18 @@ def priorTo2_13(scalaVersion: String): Boolean = } val baseSettings = Seq( - scalacOptions ++= compilerOptions, - scalacOptions ++= ( - if (priorTo2_13(scalaVersion.value)) - Seq( - "-Xfuture", - "-Yno-adapted-args", - "-Ywarn-unused-import" - ) - else - Seq( - "-Ywarn-unused:imports" - ) - ), - Compile / console / scalacOptions ~= { - _.filterNot(Set("-Ywarn-unused-import")) - }, - Test / console / scalacOptions ~= { - _.filterNot(Set("-Ywarn-unused-import")) - }, resolvers ++= Resolver.sonatypeOssRepos("releases"), resolvers ++= Resolver.sonatypeOssRepos("snapshots"), coverageHighlighting := true, - coverageEnabled := (if (scalaVersion.value.startsWith("3")) false else coverageEnabled.value), + coverageEnabled := !tlIsScala3.value, libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion, + "org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0", "io.circe" %% "circe-jawn" % circeVersion % Test, "io.circe" %% "circe-testing" % circeVersion % Test, - "org.typelevel" %% "discipline-munit" % disciplineMunitVersion % Test + "org.typelevel" %% "discipline-munit" % disciplineMunitVersion % Test, + "org.scalameta" %% "munit" % munitVersion % Test, + "org.scalameta" %% "munit-scalacheck" % munitVersion % Test ), Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "shared/src/main", Test / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "shared/src/test", @@ -137,7 +113,6 @@ lazy val jackson28 = project "-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath ), - git.remoteRepo := "git@github.com:circe/circe-jackson.git", autoAPIMappings := true, apiURL := Some(url("https://circe.github.io/circe-jackson/api/")), mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson28" % previousCirceJacksonVersion) diff --git a/project/plugins.sbt b/project/plugins.sbt index 5e1d489d..6a3ecf9e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,4 @@ addSbtPlugin("io.circe" % "sbt-circe-org" % "0.4.1") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") +addSbtPlugin("com.timushev.sbt" % "sbt-rewarn" % "0.1.3") diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala index 06a82c77..15259850 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala @@ -16,13 +16,19 @@ package io.circe.jackson -import com.fasterxml.jackson.core.{ JsonParser, JsonTokenId } -import com.fasterxml.jackson.databind.{ DeserializationContext, JsonDeserializer } +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.core.JsonTokenId +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.JsonDeserializer import com.fasterxml.jackson.databind.`type`.TypeFactory -import io.circe.{ Json, JsonBigDecimal } +import io.circe.Json +import io.circe.JsonBigDecimal + import java.util.ArrayList -import scala.annotation.{ switch, tailrec } -import scala.collection.JavaConverters._ +import scala.annotation.nowarn +import scala.annotation.switch +import scala.annotation.tailrec +import scala.jdk.CollectionConverters._ private[jackson] sealed trait DeserializerContext { def addValue(value: Json): DeserializerContext @@ -46,7 +52,7 @@ private[jackson] final case class ReadingMap(content: ArrayList[(String, Json)]) throw new Exception("Cannot add a value on an object without a key, malformed JSON object!") } -private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: Class[_]) +private[jackson] final class CirceJsonDeserializer(@nowarn factory: TypeFactory, klass: Class[_]) extends JsonDeserializer[Object] with JacksonCompat { override final def isCachable: Boolean = true @@ -64,7 +70,10 @@ private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: ctxt: DeserializationContext, parserContext: List[DeserializerContext] ): Json = { - if (jp.getCurrentToken == null) jp.nextToken() + if (jp.getCurrentToken == null) { + jp.nextToken() + () + } val (maybeValue, nextContext) = (jp.getCurrentToken.id(): @switch) match { case JsonTokenId.ID_NUMBER_INT | JsonTokenId.ID_NUMBER_FLOAT => @@ -87,7 +96,7 @@ private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: case JsonTokenId.ID_FIELD_NAME => parserContext match { - case (c: ReadingMap) :: stack => (None, c.setField(jp.getCurrentName) +: stack) + case (c: ReadingMap) :: stack => (None, c.setField(currentName(jp)) +: stack) case _ => throw new RuntimeException("We weren't reading an object, something went wrong") } @@ -113,8 +122,11 @@ private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: case maybeValue => jp.nextToken() val toPass = maybeValue.map { v => - val previous :: stack = nextContext - (previous.addValue(v)) +: stack + nextContext match { + case previous :: stack => + (previous.addValue(v)) +: stack + case Nil => nextContext + } }.getOrElse(nextContext) deserialize(jp, ctxt, toPass) diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala index 4b79cc23..0c32d4c4 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala @@ -17,20 +17,18 @@ package io.circe.jackson import com.fasterxml.jackson.core.Version -import com.fasterxml.jackson.databind.{ - BeanDescription, - DeserializationConfig, - JavaType, - JsonSerializer, - SerializationConfig -} +import com.fasterxml.jackson.databind.BeanDescription +import com.fasterxml.jackson.databind.DeserializationConfig +import com.fasterxml.jackson.databind.JavaType +import com.fasterxml.jackson.databind.JsonSerializer import com.fasterxml.jackson.databind.Module.SetupContext +import com.fasterxml.jackson.databind.SerializationConfig import com.fasterxml.jackson.databind.deser.Deserializers import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.databind.ser.Serializers import io.circe.Json -final object CirceJsonModule extends SimpleModule("CirceJson", Version.unknownVersion()) { +object CirceJsonModule extends SimpleModule("CirceJson", Version.unknownVersion()) { override final def setupModule(context: SetupContext): Unit = { context.addDeserializers( new Deserializers.Base { diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala index ffad6b67..5184b578 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala @@ -17,10 +17,17 @@ package io.circe.jackson import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.databind.{ JsonSerializer, SerializerProvider } -import io.circe.{ Json, JsonBigDecimal, JsonBiggerDecimal, JsonDecimal, JsonDouble, JsonFloat, JsonLong } +import com.fasterxml.jackson.databind.JsonSerializer +import com.fasterxml.jackson.databind.SerializerProvider +import io.circe.Json +import io.circe.JsonBigDecimal +import io.circe.JsonBiggerDecimal +import io.circe.JsonDecimal +import io.circe.JsonDouble +import io.circe.JsonFloat +import io.circe.JsonLong -private[jackson] final object CirceJsonSerializer extends JsonSerializer[Json] { +private[jackson] object CirceJsonSerializer extends JsonSerializer[Json] { import java.math.{ BigDecimal => JBigDecimal, BigInteger } import com.fasterxml.jackson.databind.node.{ BigIntegerNode, DecimalNode } diff --git a/shared/src/main/scala/io/circe/jackson/JacksonParser.scala b/shared/src/main/scala/io/circe/jackson/JacksonParser.scala index 4bf4559a..06d55172 100644 --- a/shared/src/main/scala/io/circe/jackson/JacksonParser.scala +++ b/shared/src/main/scala/io/circe/jackson/JacksonParser.scala @@ -17,7 +17,12 @@ package io.circe.jackson import cats.data.ValidatedNel -import io.circe.{ Decoder, Error, Json, Parser, ParsingFailure } +import io.circe.Decoder +import io.circe.Error +import io.circe.Json +import io.circe.Parser +import io.circe.ParsingFailure + import java.io.File import scala.util.control.NonFatal diff --git a/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala b/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala index a5ddcd52..29e0eb99 100644 --- a/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala +++ b/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala @@ -16,9 +16,12 @@ package io.circe.jackson -import com.fasterxml.jackson.core.{ JsonFactory, JsonParser } +import com.fasterxml.jackson.core.JsonFactory +import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.databind.ObjectMapper -import java.io.{ File, Writer } + +import java.io.File +import java.io.Writer class WithJacksonMapper { final val mapper: ObjectMapper = (new ObjectMapper).registerModule(CirceJsonModule) diff --git a/shared/src/main/scala/io/circe/jackson/package.scala b/shared/src/main/scala/io/circe/jackson/package.scala index 4efa34af..174944a4 100644 --- a/shared/src/main/scala/io/circe/jackson/package.scala +++ b/shared/src/main/scala/io/circe/jackson/package.scala @@ -18,10 +18,12 @@ package io.circe import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node._ + import java.io._ import java.math.{ BigDecimal => JBigDecimal } import java.nio.ByteBuffer -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ +import scala.collection.compat._ /** * Support for Jackson-powered parsing and printing for circe. @@ -48,10 +50,6 @@ package object jackson extends WithJacksonMapper with JacksonParser with Jackson sw.toString } - private[this] class EnhancedByteArrayOutputStream extends ByteArrayOutputStream { - def toByteBuffer: ByteBuffer = ByteBuffer.wrap(this.buf, 0, this.size) - } - final def jacksonPrintByteBuffer(json: Json): ByteBuffer = { val bytes = new EnhancedByteArrayOutputStream writeJson(new BufferedWriter(new OutputStreamWriter(bytes, "UTF-8")), json) @@ -86,12 +84,13 @@ package object jackson extends WithJacksonMapper with JacksonParser with Jackson try { DecimalNode.valueOf(new JBigDecimal(x)) } catch { - case nfe: NumberFormatException => TextNode.valueOf(x) + case _: NumberFormatException => TextNode.valueOf(x) } }, TextNode.valueOf(_), - array => JsonNodeFactory.instance.arrayNode.addAll(array.map(circeToJackson).asJava), - obj => objectNodeSetAll(JsonNodeFactory.instance.objectNode, obj.toMap.mapValues(circeToJackson).toMap.asJava) + array => JsonNodeFactory.instance.arrayNode.addAll(array.map(circeToJackson(_)).asJava), + obj => + objectNodeSetAll(JsonNodeFactory.instance.objectNode, obj.toMap.view.mapValues(circeToJackson(_)).toMap.asJava) ) /** @@ -111,10 +110,16 @@ package object jackson extends WithJacksonMapper with JacksonParser with Jackson Json.fromBigInt(node.bigIntegerValue) } case JsonNodeType.ARRAY => - Json.fromValues(node.elements.asScala.map(jacksonToCirce).toIterable) + Json.fromValues(node.elements.asScala.map(jacksonToCirce(_)).to(Iterable)) case JsonNodeType.OBJECT => - Json.fromFields(node.fields.asScala.map(m => (m.getKey, jacksonToCirce(m.getValue))).toIterable) + Json.fromFields(node.fields.asScala.map(m => (m.getKey, jacksonToCirce(m.getValue))).to(Iterable)) case _ => Json.Null } } + +package jackson { + private[jackson] class EnhancedByteArrayOutputStream extends ByteArrayOutputStream { + def toByteBuffer: ByteBuffer = ByteBuffer.wrap(this.buf, 0, this.size) + } +} diff --git a/shared/src/test/scala/io/circe/jackson/CirceSuite.scala b/shared/src/test/scala/io/circe/jackson/CirceSuite.scala index 23be3ca6..817db95a 100644 --- a/shared/src/test/scala/io/circe/jackson/CirceSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/CirceSuite.scala @@ -17,11 +17,12 @@ package io.circe.jackson import cats.instances.AllInstances -import cats.syntax.{ AllSyntax, EitherOps } +import cats.syntax.AllSyntax +import cats.syntax.EitherOps import io.circe.Json -import io.circe.testing.{ ArbitraryInstances, EqInstances } +import io.circe.testing.ArbitraryInstances +import io.circe.testing.EqInstances import munit.ScalaCheckSuite -import scala.language.implicitConversions /** * An opinionated stack of traits to improve consistency and reduce boilerplate in circe tests. diff --git a/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala b/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala index 725356f7..07c88439 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala @@ -19,14 +19,26 @@ package io.circe.jackson import cats.Eq import cats.instances.list._ import cats.instances.map._ -import io.circe.{ Json, JsonBigDecimal, JsonBiggerDecimal, JsonDecimal, JsonDouble, JsonFloat, JsonLong, JsonNumber } -import io.circe.Json.{ JArray, JNumber, JObject, JString } +import io.circe.Json +import io.circe.Json.JArray +import io.circe.Json.JNumber +import io.circe.Json.JObject +import io.circe.Json.JString +import io.circe.JsonBigDecimal +import io.circe.JsonBiggerDecimal +import io.circe.JsonDecimal +import io.circe.JsonDouble +import io.circe.JsonFloat +import io.circe.JsonLong +import io.circe.JsonNumber import io.circe.numbers.BiggerDecimal -import io.circe.testing.ArbitraryInstances import org.scalacheck.Arbitrary -import scala.util.matching.Regex -import scala.util.Try + import java.nio.ByteBuffer +import scala.util.Try + +import io.circe.testing.ArbitraryInstances +import scala.util.matching.Regex trait JacksonInstances { this: ArbitraryInstances => diff --git a/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala b/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala index 20bb1733..ddc3cb4b 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala @@ -18,13 +18,16 @@ package io.circe.jackson import cats.data.Validated import com.fasterxml.jackson.core.JsonToken -import com.fasterxml.jackson.databind.{ ObjectMapper, ObjectReader } +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectReader import io.circe.Json import io.circe.testing.ParserTests -import java.io.{ ByteArrayInputStream, File } +import munit.DisciplineSuite import org.scalacheck.Prop + +import java.io.ByteArrayInputStream +import java.io.File import scala.io.Source -import munit.DisciplineSuite class JacksonParserSuite extends CirceSuite with DisciplineSuite with JacksonInstances { diff --git a/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala b/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala index 29c75604..f93379bc 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala @@ -17,9 +17,10 @@ package io.circe.jackson import io.circe.Json -import java.nio.ByteBuffer import org.scalacheck.Prop.forAll +import java.nio.ByteBuffer + class JacksonPrintingSuite extends CirceSuite with JacksonInstances { property("jacksonPrint should produce round-trippable output") { forAll { (json: Json) => From 051a1edcadfb29c7d62ebd99b4fc94f2c2657eac Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Tue, 2 Jul 2024 12:04:56 +0200 Subject: [PATCH 06/10] mima exclusion --- build.sbt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index abf6c395..b76dcfcc 100644 --- a/build.sbt +++ b/build.sbt @@ -1,3 +1,5 @@ +import com.typesafe.tools.mima.core._ + ThisBuild / organization := "io.circe" ThisBuild / crossScalaVersions := Seq("2.13.14", "2.12.19", "3.3.3") ThisBuild / scalaVersion := crossScalaVersions.value.head @@ -48,7 +50,13 @@ def jacksonDependencies(version: String, databindVersion: Option[String] = None) "com.fasterxml.jackson.core" % "jackson-databind" % databindVersion.getOrElse(version) ) -val allSettings = baseSettings ++ publishSettings +val mimaSettings = Seq( + mimaBinaryIssueFilters ++= Seq( + ProblemFilters.exclude[MissingClassProblem]("io.circe.jackson.package$EnhancedByteArrayOutputStream") + ) +) + +val allSettings = baseSettings ++ publishSettings ++ mimaSettings val root = project .in(file(".")) From 827109706ca7a199af93e7752c9162f308b6879c Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Tue, 2 Jul 2024 12:07:13 +0200 Subject: [PATCH 07/10] Circe 0.14.9 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b76dcfcc..c5e8a1cc 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,7 @@ ThisBuild / ScalafixConfig / skip := tlIsScala3.value ThisBuild / tlCiScalafixCheck := false // TODO: Address these in a follow up PR ThisBuild / tlFatalWarnings := false // TODO: fix by dropping 2.12 -val circeVersion = "0.14.8" +val circeVersion = "0.14.9" val munitVersion = "1.0.0" val previousCirceJacksonVersion = "0.14.0" val disciplineMunitVersion = "2.0.0" From 5b6ba44fba557d18df61da2e37f3322e277f8b82 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Tue, 2 Jul 2024 12:16:55 +0200 Subject: [PATCH 08/10] Remove mima checks, since we start a new series --- build.sbt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index c5e8a1cc..f7d1b982 100644 --- a/build.sbt +++ b/build.sbt @@ -13,7 +13,7 @@ ThisBuild / tlFatalWarnings := false // TODO: fix by dropping 2.12 val circeVersion = "0.14.9" val munitVersion = "1.0.0" -val previousCirceJacksonVersion = "0.14.0" +val previousCirceJacksonVersion = "0.15.0" val disciplineMunitVersion = "2.0.0" def priorTo2_13(scalaVersion: String): Boolean = @@ -50,13 +50,7 @@ def jacksonDependencies(version: String, databindVersion: Option[String] = None) "com.fasterxml.jackson.core" % "jackson-databind" % databindVersion.getOrElse(version) ) -val mimaSettings = Seq( - mimaBinaryIssueFilters ++= Seq( - ProblemFilters.exclude[MissingClassProblem]("io.circe.jackson.package$EnhancedByteArrayOutputStream") - ) -) - -val allSettings = baseSettings ++ publishSettings ++ mimaSettings +val allSettings = baseSettings ++ publishSettings val root = project .in(file(".")) From 867e49fcb0e1a359b6a18fbfd8e33f5b583f2757 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Tue, 2 Jul 2024 12:21:35 +0200 Subject: [PATCH 09/10] Autodetect mima --- build.sbt | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/build.sbt b/build.sbt index f7d1b982..90e445f2 100644 --- a/build.sbt +++ b/build.sbt @@ -78,8 +78,7 @@ lazy val jackson25 = project .settings(allSettings) .settings( moduleName := "circe-jackson25", - libraryDependencies ++= jacksonDependencies("2.5.5"), - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson25" % previousCirceJacksonVersion) + libraryDependencies ++= jacksonDependencies("2.5.5") ) lazy val jackson26 = project @@ -88,8 +87,7 @@ lazy val jackson26 = project .settings( moduleName := "circe-jackson26", libraryDependencies ++= jacksonDependencies("2.6.7", Some("2.6.7.5")), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "27", - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson26" % previousCirceJacksonVersion) + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "27" ) lazy val jackson27 = project @@ -97,8 +95,7 @@ lazy val jackson27 = project .settings(allSettings) .settings( moduleName := "circe-jackson27", - libraryDependencies ++= jacksonDependencies("2.7.9", Some("2.7.9.7")), - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson27" % previousCirceJacksonVersion) + libraryDependencies ++= jacksonDependencies("2.7.9", Some("2.7.9.7")) ) lazy val jackson28 = project @@ -116,8 +113,7 @@ lazy val jackson28 = project (LocalRootProject / baseDirectory).value.getAbsolutePath ), autoAPIMappings := true, - apiURL := Some(url("https://circe.github.io/circe-jackson/api/")), - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson28" % previousCirceJacksonVersion) + apiURL := Some(url("https://circe.github.io/circe-jackson/api/")) ) lazy val jackson29 = project @@ -126,8 +122,7 @@ lazy val jackson29 = project .settings( moduleName := "circe-jackson29", libraryDependencies ++= jacksonDependencies("2.9.10", Some("2.9.10.8")), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "28", - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson29" % previousCirceJacksonVersion) + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "28" ) lazy val jackson210 = project @@ -228,11 +223,8 @@ lazy val publishSettings = Seq( Test / publishArtifact := false, pomIncludeRepository := { _ => false }, developers := List( - Developer( - "travisbrown", - "Travis Brown", - "travisrobertbrown@gmail.com", - url("https://twitter.com/travisbrown") - ) + tlGitHubDev("travisbrown", "Travis Brown"), + tlGitHubDev("zathross", "Darren Gibson"), + tlGitHubDev("hamnis", "Erlend Hamnaberg") ) ) From 936b2b1a23c6e27c7bd8e01aee50ee7b39859077 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Tue, 2 Jul 2024 13:05:01 +0200 Subject: [PATCH 10/10] No new series required --- build.sbt | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 90e445f2..cc07ff84 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ ThisBuild / crossScalaVersions := Seq("2.13.14", "2.12.19", "3.3.3") ThisBuild / scalaVersion := crossScalaVersions.value.head ThisBuild / githubWorkflowPublishTargetBranches := Nil ThisBuild / startYear := Some(2016) -ThisBuild / tlBaseVersion := "0.15" +ThisBuild / tlBaseVersion := "0.14" ThisBuild / scalafixAll / skip := tlIsScala3.value ThisBuild / ScalafixConfig / skip := tlIsScala3.value ThisBuild / tlCiScalafixCheck := false // TODO: Address these in a follow up PR @@ -50,7 +50,13 @@ def jacksonDependencies(version: String, databindVersion: Option[String] = None) "com.fasterxml.jackson.core" % "jackson-databind" % databindVersion.getOrElse(version) ) -val allSettings = baseSettings ++ publishSettings +val mimaSettings = Seq( + mimaBinaryIssueFilters ++= Seq( + ProblemFilters.exclude[MissingClassProblem]("io.circe.jackson.package$EnhancedByteArrayOutputStream") + ) +) + +val allSettings = baseSettings ++ publishSettings ++ mimaSettings val root = project .in(file(".")) @@ -158,7 +164,8 @@ lazy val jackson213 = project .settings( moduleName := "circe-jackson213", libraryDependencies ++= jacksonDependencies("2.13.5"), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap ) lazy val jackson214 = project @@ -167,7 +174,8 @@ lazy val jackson214 = project .settings( moduleName := "circe-jackson214", libraryDependencies ++= jacksonDependencies("2.14.3"), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap ) lazy val jackson215 = project .in(file("215")) @@ -175,7 +183,8 @@ lazy val jackson215 = project .settings( moduleName := "circe-jackson215", libraryDependencies ++= jacksonDependencies("2.15.4"), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap ) lazy val jackson216 = project @@ -184,7 +193,8 @@ lazy val jackson216 = project .settings( moduleName := "circe-jackson216", libraryDependencies ++= jacksonDependencies("2.16.2"), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap ) lazy val jackson217 = project @@ -193,7 +203,8 @@ lazy val jackson217 = project .settings( moduleName := "circe-jackson217", libraryDependencies ++= jacksonDependencies("2.17.1"), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap ) lazy val benchmark = project