diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e13b487..7e59767 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,11 +118,11 @@ 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 scala-xml-1/target scala-xml-2/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 scala-xml-1/target scala-xml-2/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') 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 5f6a143..117d6d7 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,4 @@ -ThisBuild / tlBaseVersion := "0.23" +ThisBuild / tlBaseVersion := "0.24" ThisBuild / developers := List( tlGitHubDev("rossabaker", "Ross A. Baker") ) @@ -9,52 +9,32 @@ val Scala213 = "2.13.16" ThisBuild / crossScalaVersions := Seq(Scala212, Scala213, "3.3.6") ThisBuild / scalaVersion := Scala213 -lazy val root = project.in(file(".")).aggregate(scalaXml2, scalaXml1).enablePlugins(NoPublishPlugin) +lazy val root = project.in(file(".")).aggregate(scalaXml).enablePlugins(NoPublishPlugin) val http4sVersion = "0.23.30" val scalacheckXmlVersion = "0.1.1" -val scalaXml1Version = "1.3.1" -val scalaXml2Version = "2.3.0" +val scalaXml2Version = "2.4.0" val munitVersion = "1.1.0" val munitCatsEffectVersion = "2.1.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" % scalaXml2Version, - commonSettings, - ) - -lazy val scalaXml1 = project - .in(file("scala-xml-1")) - .settings( - name := "http4s-scala-xml-1", - description := "Provides scala-xml codecs for http4s", - tlMimaPreviousVersions ++= Set("0.23.0"), - crossScalaVersions := Seq(Scala212, Scala213), - libraryDependencies += "org.scala-lang.modules" %%% "scala-xml" % scalaXml1Version, - dependencyOverrides += "org.scala-lang.modules" %%% "scala-xml" % scalaXml1Version, - commonSettings, + libraryDependencies ++= Seq( + "org.http4s" %%% "http4s-core" % http4sVersion, + "org.http4s" %%% "http4s-laws" % http4sVersion % Test, + "org.scala-lang.modules" %%% "scala-xml" % scalaXml2Version, + "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/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 84e127e..4d5f648 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) } }