Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
48 changes: 14 additions & 34 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / tlBaseVersion := "0.23"
ThisBuild / tlBaseVersion := "0.24"
ThisBuild / developers := List(
tlGitHubDev("rossabaker", "Ross A. Baker")
)
Expand All @@ -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,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
}
}

Expand Down