Skip to content

Commit 32d4bba

Browse files
authored
Merge pull request #76 from http4s/1.0.0-M38
Release v1.0.0-M38 on http4s-core-1.0.0-M38
2 parents 861657f + 172ee91 commit 32d4bba

File tree

12 files changed

+221
-75
lines changed

12 files changed

+221
-75
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ name: Continuous Integration
99

1010
on:
1111
pull_request:
12-
branches: ['**']
12+
branches: ['**', '!update/**', '!pr/**']
1313
push:
14-
branches: ['**']
14+
branches: ['**', '!update/**', '!pr/**']
1515
tags: [v*]
1616

1717
env:
@@ -29,12 +29,12 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
os: [ubuntu-latest]
32-
scala: [2.13.8, 3.1.2]
32+
scala: [2.13.8, 3.2.1]
3333
java: [temurin@8, temurin@11, temurin@17]
3434
exclude:
35-
- scala: 3.1.2
35+
- scala: 3.2.1
3636
java: temurin@11
37-
- scala: 3.1.2
37+
- scala: 3.2.1
3838
java: temurin@17
3939
runs-on: ${{ matrix.os }}
4040
steps:
@@ -104,7 +104,7 @@ jobs:
104104
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
105105

106106
- name: Check that workflows are up to date
107-
run: sbt '++${{ matrix.scala }}' 'project /' githubWorkflowCheck
107+
run: sbt githubWorkflowCheck
108108

109109
- name: Check headers and formatting
110110
if: matrix.java == 'temurin@8'
@@ -121,17 +121,21 @@ jobs:
121121
if: matrix.java == 'temurin@8'
122122
run: sbt '++${{ matrix.scala }}' doc
123123

124+
- name: Check scalafix lints
125+
if: matrix.java == 'temurin@8' && !startsWith(matrix.scala, '3.')
126+
run: sbt '++${{ matrix.scala }}' 'scalafixAll --check'
127+
124128
- name: Check unused compile dependencies
125129
if: matrix.java == 'temurin@8'
126130
run: sbt '++${{ matrix.scala }}' unusedCompileDependenciesTest
127131

128132
- name: Make target directories
129133
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
130-
run: mkdir -p target scala-xml/target site/target project/target
134+
run: mkdir -p target scala-xml-2/target site/target project/target
131135

132136
- name: Compress target directories
133137
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
134-
run: tar cf targets.tar target scala-xml/target site/target project/target
138+
run: tar cf targets.tar target scala-xml-2/target site/target project/target
135139

136140
- name: Upload target directories
137141
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
@@ -226,32 +230,12 @@ jobs:
226230
tar xf targets.tar
227231
rm targets.tar
228232
229-
- name: Download target directories (2.13.8)
230-
uses: actions/download-artifact@v2
231-
with:
232-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8
233-
234-
- name: Inflate target directories (2.13.8)
235-
run: |
236-
tar xf targets.tar
237-
rm targets.tar
238-
239-
- name: Download target directories (2.13.8)
240-
uses: actions/download-artifact@v2
241-
with:
242-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8
243-
244-
- name: Inflate target directories (2.13.8)
245-
run: |
246-
tar xf targets.tar
247-
rm targets.tar
248-
249-
- name: Download target directories (3.1.2)
233+
- name: Download target directories (3.2.1)
250234
uses: actions/download-artifact@v2
251235
with:
252-
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2
236+
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1
253237

254-
- name: Inflate target directories (3.1.2)
238+
- name: Inflate target directories (3.2.1)
255239
run: |
256240
tar xf targets.tar
257241
rm targets.tar

.scalafix.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
rules = [
2+
Http4sFs2Linters
3+
Http4sGeneralLinters
4+
Http4sUseLiteralsSyntax
5+
LeakingImplicitClassVal
6+
ExplicitResultTypes
7+
OrganizeImports
8+
]
9+
10+
triggered.rules = [
11+
Http4sFs2Linters
12+
Http4sGeneralLinters
13+
Http4sUseLiteralsSyntax
14+
LeakingImplicitClassVal
15+
]

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.5.8
1+
version = 3.6.1
22

33
style = default
44

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# http4s-scala-xml
2+
3+
Provides http4s entity codec instances for [scala-xml].
4+
5+
## `http4s-scala-xml`
6+
7+
This is probably the artifact you want. It works with scala-xml-2.x.
8+
9+
### SBT coordinates
10+
11+
```scala
12+
libraryDependencies ++= Seq(
13+
"org.http4s" %% "http4s-scala-xml" % http4sScalaXmlV
14+
)
15+
```
16+
17+
## `http4s-scala-xml-1`
18+
19+
This repository also publishes an alternate `http4s-scala-xml-1`
20+
artifact. The Scala package is the same, so this dependency must
21+
never be bundled with `http4s-scala-xml`. It exists because several
22+
signficant libraries, like [Twirl], are still based on scala-xml-1.x
23+
in Scala 2. Use this library to avoid diamond dependencies, but
24+
upgrade when you can.
25+
26+
### SBT coordinates
27+
28+
```scala
29+
libraryDependencies ++= Seq(
30+
"org.http4s" %% "http4s-scala-xml-1" % http4sScalaXmlV
31+
)
32+
```
33+
34+
35+
## Compatibility
36+
37+
| artifact | version | http4s-core | scala-xml | Scala 2.12 | Scala 2.13 | Scala 3 | Status | |
38+
|:-------------------|:--------|:------------|:----------|------------|------------|---------|--------|---|
39+
| http4s-scala-xml | 0.23.x | 0.23.x | 2.x |||| Stable | |
40+
| http4s-scala-xml-1 | 0.23.x | 0.23.x | 1.x |||| Stable | |
41+
42+
[scala-xml]: https://github.com/scala/scala-xml
43+
[twirl]: https://github.com/playframework/twirl

build.sbt

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,45 @@ ThisBuild / tlBaseVersion := "1.0"
22
ThisBuild / developers := List(
33
tlGitHubDev("rossabaker", "Ross A. Baker")
44
)
5+
ThisBuild / startYear := Some(2014)
56

67
val Scala213 = "2.13.8"
7-
ThisBuild / crossScalaVersions := Seq(Scala213, "3.1.2")
8+
ThisBuild / crossScalaVersions := Seq(Scala213, "3.2.1")
89
ThisBuild / scalaVersion := Scala213
910

10-
lazy val root = project.in(file(".")).aggregate(scalaXml).enablePlugins(NoPublishPlugin)
11+
lazy val root = project.in(file(".")).aggregate(scalaXml2).enablePlugins(NoPublishPlugin)
1112

12-
val http4sVersion = "1.0.0-M35"
13+
val http4sVersion = "1.0.0-M38"
14+
val scalacheckXmlVersion = "0.1.0"
1315
val scalaXmlVersion = "2.1.0"
14-
val munitVersion = "0.7.29"
15-
val munitCatsEffectVersion = "1.0.7"
16+
val munitVersion = "1.0.0-M7"
17+
val munitCatsEffectVersion = "2.0.0-M3"
1618

17-
lazy val scalaXml = project
18-
.in(file("scala-xml"))
19+
lazy val scalaXml2 = project
20+
.in(file("scala-xml-2"))
1921
.settings(
2022
name := "http4s-scala-xml",
2123
description := "Provides scala-xml codecs for http4s",
22-
startYear := Some(2014),
23-
libraryDependencies ++= Seq(
24-
"org.http4s" %%% "http4s-core" % http4sVersion,
25-
"org.scala-lang.modules" %%% "scala-xml" % scalaXmlVersion,
26-
"org.scalameta" %%% "munit-scalacheck" % munitVersion % Test,
27-
"org.typelevel" %%% "munit-cats-effect-3" % munitCatsEffectVersion % Test,
28-
"org.http4s" %%% "http4s-laws" % http4sVersion % Test,
29-
),
24+
tlMimaPreviousVersions ++= (0 to 11).map(y => s"0.23.$y").toSet,
25+
libraryDependencies += "org.scala-lang.modules" %%% "scala-xml" % scalaXmlVersion,
26+
commonSettings,
3027
)
3128

29+
lazy val commonSettings = Seq(
30+
Compile / unmanagedSourceDirectories += (LocalRootProject / baseDirectory).value / "scala-xml" / "src" / "main" / "scala",
31+
Test / unmanagedSourceDirectories += (LocalRootProject / baseDirectory).value / "scala-xml" / "src" / "test" / "scala",
32+
libraryDependencies ++= Seq(
33+
"org.http4s" %%% "http4s-core" % http4sVersion,
34+
"org.http4s" %%% "http4s-laws" % http4sVersion % Test,
35+
"org.scalameta" %%% "munit-scalacheck" % munitVersion % Test,
36+
"org.typelevel" %%% "munit-cats-effect" % munitCatsEffectVersion % Test,
37+
"org.typelevel" %%% "scalacheck-xml" % scalacheckXmlVersion % Test,
38+
),
39+
)
40+
3241
lazy val docs = project
3342
.in(file("site"))
34-
.dependsOn(scalaXml)
43+
.dependsOn(scalaXml2)
3544
.settings(
3645
libraryDependencies ++= Seq(
3746
"org.http4s" %%% "http4s-dsl" % http4sVersion,

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class JsonXmlHttpEndpoint[F[_]](implicit F: Async[F]) extends Http4sDsl[F] {
3838
}
3939

4040
private def personXmlDecoder: EntityDecoder[F, Person] =
41-
org.http4s.scalaxml.xml[F].map(Person.fromXml)
41+
org.http4s.scalaxml.xmlDecoder[F].map(Person.fromXml)
4242

4343
implicit private def jsonXmlDecoder: EntityDecoder[F, Person] =
4444
jsonOf[F, Person].orElse(personXmlDecoder)
@@ -55,4 +55,4 @@ class JsonXmlHttpEndpoint[F[_]](implicit F: Async[F]) extends Http4sDsl[F] {
5555
}
5656
}
5757
}
58-
```
58+
```

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.6.2
1+
sbt.version=1.8.1

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.13.4")
1+
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.14.7")
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2014 http4s.org
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.http4s.scalaxml
18+
19+
import scala.xml._
20+
import scala.xml.transform._
21+
22+
trait ScalaXmlSuiteVersion {
23+
object stripComments extends RewriteRule {
24+
override def transform(n: Node): Seq[Node] =
25+
n match {
26+
case _: Comment => Seq.empty
27+
case n => Seq(n)
28+
}
29+
}
30+
31+
object trimProper extends RewriteRule {
32+
override def transform(n: Node): Seq[Node] =
33+
Utility.trimProper(n)
34+
}
35+
36+
// https://github.com/http4s/http4s-scala-xml/issues/32
37+
object normalize extends RuleTransformer(stripComments, trimProper)
38+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2014 http4s.org
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.http4s.scalaxml
18+
19+
import scala.xml.transform._
20+
21+
trait ScalaXmlSuiteVersion {
22+
// https://github.com/http4s/http4s-scala-xml/issues/32
23+
//
24+
// Nothing to do here but make the tests compatible with
25+
// scala-xml-1's parser.
26+
object normalize extends RuleTransformer()
27+
}

0 commit comments

Comments
 (0)