diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81ef2a1..9b2311f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,114 +15,97 @@ on: tags: [v*] env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }} @ ${{ github.ref }} + cancel-in-progress: true + jobs: build: - name: Build and Test + name: Test strategy: fail-fast: false matrix: - os: [ubuntu-latest] - scala: [2.13.12, 3.3.3] + os: [ubuntu-22.04] + scala: [2.13, 3] java: [temurin@8, temurin@11, temurin@17] exclude: - - scala: 3.3.3 + - scala: 3 java: temurin@11 - - scala: 3.3.3 + - scala: 3 java: temurin@17 runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 0 - - name: Download Java (temurin@8) - id: download-java-temurin-8 - if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 8 + - name: Setup sbt + uses: sbt/setup-sbt@v1 - name: Setup Java (temurin@8) + id: setup-java-temurin-8 if: matrix.java == 'temurin@8' - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 8 - jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + cache: sbt - - name: Download Java (temurin@11) - id: download-java-temurin-11 - if: matrix.java == 'temurin@11' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 11 + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update - name: Setup Java (temurin@11) + id: setup-java-temurin-11 if: matrix.java == 'temurin@11' - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 11 - jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }} + cache: sbt - - name: Download Java (temurin@17) - id: download-java-temurin-17 - if: matrix.java == 'temurin@17' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 17 + - 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@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 17 - jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} + cache: sbt - - name: Cache sbt - uses: actions/cache@v3 - 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') }} + - 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 githubWorkflowCheck - name: Check headers and formatting - if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04' run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck - name: Test run: sbt '++ ${{ matrix.scala }}' test - name: Check binary compatibility - if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04' run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues - name: Generate API documentation - if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04' run: sbt '++ ${{ matrix.scala }}' doc - name: Check scalafix lints - if: matrix.java == 'temurin@8' && !startsWith(matrix.scala, '3.') + if: matrix.java == 'temurin@8' && !startsWith(matrix.scala, '3') run: sbt '++ ${{ matrix.scala }}' 'scalafixAll --check' - name: Check unused compile dependencies @@ -131,15 +114,15 @@ jobs: - name: Make target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: mkdir -p target scala-xml-2/target site/target project/target + run: mkdir -p scala-xml/target project/target - name: Compress target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: tar cf targets.tar target scala-xml-2/target site/target project/target + run: tar cf targets.tar scala-xml/target project/target - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v5 with: name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }} path: targets.tar @@ -150,118 +133,181 @@ jobs: if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-22.04] java: [temurin@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 0 - - name: Download Java (temurin@8) - id: download-java-temurin-8 - if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 8 + - name: Setup sbt + uses: sbt/setup-sbt@v1 - name: Setup Java (temurin@8) + id: setup-java-temurin-8 if: matrix.java == 'temurin@8' - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 8 - jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + cache: sbt - - name: Download Java (temurin@11) - id: download-java-temurin-11 - if: matrix.java == 'temurin@11' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 11 + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update - name: Setup Java (temurin@11) + id: setup-java-temurin-11 if: matrix.java == 'temurin@11' - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 11 - jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }} + cache: sbt - - name: Download Java (temurin@17) - id: download-java-temurin-17 - if: matrix.java == 'temurin@17' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 17 + - 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@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 17 - jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} + cache: sbt - - name: Cache sbt - uses: actions/cache@v3 - 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') }} - - - name: Download target directories (2.13.12) - uses: actions/download-artifact@v3 + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update + + - name: Download target directories (2.13) + uses: actions/download-artifact@v6 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.12 + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13 - - name: Inflate target directories (2.13.12) + - name: Inflate target directories (2.13) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (3.3.3) - uses: actions/download-artifact@v3 + - name: Download target directories (3) + uses: actions/download-artifact@v6 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.3 + name: target-${{ matrix.os }}-${{ matrix.java }}-3 - - name: Inflate target directories (3.3.3) + - name: Inflate target directories (3) run: | tar xf targets.tar rm targets.tar - name: Import signing key if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' - run: echo $PGP_SECRET | base64 -di | gpg --import + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: echo $PGP_SECRET | base64 -d -i - | gpg --import - name: Import signing key and strip passphrase if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} run: | - echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg + echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) - name: Publish + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} run: sbt tlCiRelease + dependency-submission: + name: Submit Dependencies + if: github.event.repository.fork == false && github.event_name != 'pull_request' + strategy: + matrix: + os: [ubuntu-22.04] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup sbt + uses: sbt/setup-sbt@v1 + + - name: Setup Java (temurin@8) + id: setup-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 8 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update + + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v5 + 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@v5 + 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: + modules-ignore: root_2.13 root_3 docs_2.13 docs_3 sbt-http4s-org-scalafix-internal_2.13 sbt-http4s-org-scalafix-internal_3 + configs-ignore: test scala-tool scala-doc-tool test-internal + validate-steward: name: Validate Steward Config strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-22.04] + java: [temurin@11] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (fast) - uses: actions/checkout@v3 + uses: actions/checkout@v6 + + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 11 - uses: coursier/setup-action@v1 with: @@ -273,81 +319,63 @@ jobs: name: Generate Site strategy: matrix: - os: [ubuntu-latest] - java: [temurin@8] + os: [ubuntu-22.04] + java: [temurin@11] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 0 - - name: Download Java (temurin@8) - id: download-java-temurin-8 - if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 8 + - name: Setup sbt + uses: sbt/setup-sbt@v1 - name: Setup Java (temurin@8) + id: setup-java-temurin-8 if: matrix.java == 'temurin@8' - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 8 - jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + cache: sbt - - name: Download Java (temurin@11) - id: download-java-temurin-11 - if: matrix.java == 'temurin@11' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 11 + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update - name: Setup Java (temurin@11) + id: setup-java-temurin-11 if: matrix.java == 'temurin@11' - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 11 - jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }} + cache: sbt - - name: Download Java (temurin@17) - id: download-java-temurin-17 - if: matrix.java == 'temurin@17' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 17 + - 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@v3 + uses: actions/setup-java@v5 with: - distribution: jdkfile + distribution: temurin java-version: 17 - jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} + cache: sbt - - name: Cache sbt - uses: actions/cache@v3 - 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') }} + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update - name: Generate site run: sbt docs/tlSite - name: Publish site if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - uses: peaceiris/actions-gh-pages@v3.9.0 + uses: peaceiris/actions-gh-pages@v4.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site/target/docs/site diff --git a/.scalafmt.conf b/.scalafmt.conf index 9160023..16d4210 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.8.1 +version = 3.11.1 style = default diff --git a/README.md b/README.md index 59e6cf4..5c1204a 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,13 @@ libraryDependencies ++= Seq( ## `http4s-scala-xml-1` -This repository also publishes an alternate `http4s-scala-xml-1` +> [!NOTE] +> This module is available only in the 0.23 series. + +This repository also published an alternate `http4s-scala-xml-1` artifact. The Scala package is the same, so this dependency must never be bundled with `http4s-scala-xml`. It exists because several -signficant libraries, like [Twirl], are still based on scala-xml-1.x +significant libraries, like [Twirl], are still based on scala-xml-1.x in Scala 2. Use this library to avoid diamond dependencies, but upgrade when you can. @@ -34,10 +37,11 @@ libraryDependencies ++= Seq( ## Compatibility -| artifact | version | http4s-core | scala-xml | Scala 2.12 | Scala 2.13 | Scala 3 | Status | | -|:-------------------|:--------|:------------|:----------|------------|------------|---------|--------|---| -| http4s-scala-xml | 0.23.x | 0.23.x | 2.x | ✅ | ✅ | ✅ | Stable | | -| http4s-scala-xml-1 | 0.23.x | 0.23.x | 1.x | ✅ | ✅ | ❌ | Stable | | +| artifact | version | http4s-core | scala-xml | Scala 2.12 | Scala 2.13 | Scala 3 | Status | +|:-------------------|:--------|:------------|:----------|------------|------------|---------|--------| +| http4s-scala-xml | 0.24.x | 0.23.x | 2.4.x | ✅ | ✅ | ✅ | Stable | +| http4s-scala-xml | 0.23.x | 0.23.x | 2.3.x | ✅ | ✅ | ✅ | EOL | +| http4s-scala-xml-1 | 0.23.x | 0.23.x | 1.x | ✅ | ✅ | ❌ | EOL | [scala-xml]: https://github.com/scala/scala-xml [twirl]: https://github.com/playframework/twirl diff --git a/build.sbt b/build.sbt index e1d958b..1ae5235 100644 --- a/build.sbt +++ b/build.sbt @@ -4,43 +4,36 @@ ThisBuild / developers := List( ) ThisBuild / startYear := Some(2014) -val Scala213 = "2.13.12" -ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.3") +val Scala213 = "2.13.18" +ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.8") ThisBuild / scalaVersion := Scala213 -lazy val root = project.in(file(".")).aggregate(scalaXml2).enablePlugins(NoPublishPlugin) +lazy val root = project.in(file(".")).aggregate(scalaXml).enablePlugins(NoPublishPlugin) val http4sVersion = "1.0.0-M44" -val scalacheckXmlVersion = "0.1.0" -val scalaXmlVersion = "2.3.0" -val munitVersion = "1.0.0" -val munitCatsEffectVersion = "2.0.0-RC1" +val scalacheckXmlVersion = "0.1.1" +val scalaXmlVersion = "2.4.0" +val munitVersion = "1.3.0" +val munitCatsEffectVersion = "2.2.0" -lazy val scalaXml2 = project - .in(file("scala-xml-2")) +lazy val scalaXml = project + .in(file("scala-xml")) .settings( name := "http4s-scala-xml", description := "Provides scala-xml codecs for http4s", - tlMimaPreviousVersions ++= (0 to 11).map(y => s"0.23.$y").toSet, - libraryDependencies += "org.scala-lang.modules" %%% "scala-xml" % scalaXmlVersion, - commonSettings, + libraryDependencies ++= Seq( + "org.http4s" %%% "http4s-core" % http4sVersion, + "org.http4s" %%% "http4s-laws" % http4sVersion % Test, + "org.scala-lang.modules" %%% "scala-xml" % scalaXmlVersion, + "org.scalameta" %%% "munit-scalacheck" % munitVersion % Test, + "org.typelevel" %%% "munit-cats-effect" % munitCatsEffectVersion % Test, + "org.typelevel" %%% "scalacheck-xml" % scalacheckXmlVersion % Test, + ), ) -lazy val commonSettings = Seq( - Compile / unmanagedSourceDirectories += (LocalRootProject / baseDirectory).value / "scala-xml" / "src" / "main" / "scala", - Test / unmanagedSourceDirectories += (LocalRootProject / baseDirectory).value / "scala-xml" / "src" / "test" / "scala", - libraryDependencies ++= Seq( - "org.http4s" %%% "http4s-core" % http4sVersion, - "org.http4s" %%% "http4s-laws" % http4sVersion % Test, - "org.scalameta" %%% "munit-scalacheck" % munitVersion % Test, - "org.typelevel" %%% "munit-cats-effect" % munitCatsEffectVersion % Test, - "org.typelevel" %%% "scalacheck-xml" % scalacheckXmlVersion % Test, - ), -) - lazy val docs = project .in(file("site")) - .dependsOn(scalaXml2) + .dependsOn(scalaXml) .settings( libraryDependencies ++= Seq( "org.http4s" %%% "http4s-dsl" % http4sVersion, diff --git a/project/build.properties b/project/build.properties index 04267b1..7c95fc1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.9 +sbt.version=1.12.13 diff --git a/project/plugins.sbt b/project/plugins.sbt index c0a460f..d0fe466 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.14.13") +addSbtPlugin("org.http4s" % "sbt-http4s-org" % "2.0.6") diff --git a/scala-xml-1/src/test/scala/org/http4s/scalaxml/ScalaXmlSuiteVersion.scala b/scala-xml-1/src/test/scala/org/http4s/scalaxml/ScalaXmlSuiteVersion.scala deleted file mode 100644 index fedcc5d..0000000 --- a/scala-xml-1/src/test/scala/org/http4s/scalaxml/ScalaXmlSuiteVersion.scala +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2014 http4s.org - * - * 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 org.http4s.scalaxml - -import scala.xml._ -import scala.xml.transform._ - -trait ScalaXmlSuiteVersion { - object stripComments extends RewriteRule { - override def transform(n: Node): Seq[Node] = - n match { - case _: Comment => Seq.empty - case n => Seq(n) - } - } - - object trimProper extends RewriteRule { - override def transform(n: Node): Seq[Node] = - Utility.trimProper(n) - } - - // https://github.com/http4s/http4s-scala-xml/issues/32 - object normalize extends RuleTransformer(stripComments, trimProper) -} diff --git a/scala-xml-2/src/test/scala/org/http4s/scalaxml/ScalaXmlSuiteVersion.scala b/scala-xml-2/src/test/scala/org/http4s/scalaxml/ScalaXmlSuiteVersion.scala deleted file mode 100644 index 5f38d96..0000000 --- a/scala-xml-2/src/test/scala/org/http4s/scalaxml/ScalaXmlSuiteVersion.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2014 http4s.org - * - * 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 org.http4s.scalaxml - -import scala.xml.transform._ - -trait ScalaXmlSuiteVersion { - // https://github.com/http4s/http4s-scala-xml/issues/32 - // - // Nothing to do here but make the tests compatible with - // scala-xml-1's parser. - object normalize extends RuleTransformer() -} diff --git a/scala-xml/src/test/scala/org/http4s/scalaxml/ScalaXmlSuite.scala b/scala-xml/src/test/scala/org/http4s/scalaxml/ScalaXmlSuite.scala index 868696e..10846c8 100644 --- a/scala-xml/src/test/scala/org/http4s/scalaxml/ScalaXmlSuite.scala +++ b/scala-xml/src/test/scala/org/http4s/scalaxml/ScalaXmlSuite.scala @@ -36,7 +36,7 @@ import org.typelevel.scalacheck.xml.generators._ import java.nio.charset.StandardCharsets import scala.xml.Elem -class ScalaXmlSuite extends CatsEffectSuite with ScalaCheckEffectSuite with ScalaXmlSuiteVersion { +class ScalaXmlSuite extends CatsEffectSuite with ScalaCheckEffectSuite { def getBody(body: EntityBody[IO]): IO[String] = body.through(utf8.decode).foldMonoid.compile.lastOrError @@ -60,11 +60,10 @@ class ScalaXmlSuite extends CatsEffectSuite with ScalaCheckEffectSuite with Scal test("round trips utf-8") { forAllF(genXml) { (elem: Elem) => - val normalized = normalize(elem).asInstanceOf[Elem] Request[IO]() - .withEntity(normalized) + .withEntity(elem) .as[Elem] - .assertEquals(normalized) + .assertEquals(elem) } }