Skip to content

Commit 6c7dde0

Browse files
committed
Merge branch 'series/0.24' into series/0.25
2 parents 38cc167 + 10de37d commit 6c7dde0

File tree

14 files changed

+135
-111
lines changed

14 files changed

+135
-111
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
os: [ubuntu-latest]
32-
scala: [2.12.16, 2.13.8, 3.2.1]
32+
scala: [2.12.17, 2.13.10, 3.2.1]
3333
java: [temurin@11, temurin@17]
3434
project: [rootJVM]
3535
exclude:
36-
- scala: 2.12.16
36+
- scala: 2.12.17
3737
java: temurin@17
3838
- scala: 3.2.1
3939
java: temurin@17
@@ -89,30 +89,30 @@ jobs:
8989
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
9090

9191
- name: Check that workflows are up to date
92-
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck
92+
run: sbt githubWorkflowCheck
9393

9494
- name: Check headers and formatting
9595
if: matrix.java == 'temurin@11'
96-
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
96+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
9797

9898
- name: Test
99-
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test
99+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test
100100

101101
- name: Check binary compatibility
102102
if: matrix.java == 'temurin@11'
103-
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues
103+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues
104104

105105
- name: Generate API documentation
106106
if: matrix.java == 'temurin@11'
107-
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc
107+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc
108108

109109
- name: Check scalafix lints
110110
if: matrix.java == 'temurin@11' && !startsWith(matrix.scala, '3.')
111-
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'scalafixAll --check'
111+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' 'scalafixAll --check'
112112

113113
- name: Check unused compile dependencies
114114
if: matrix.java == 'temurin@11'
115-
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' unusedCompileDependenciesTest
115+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' unusedCompileDependenciesTest
116116

117117
- name: Make target directories
118118
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
@@ -136,7 +136,7 @@ jobs:
136136
strategy:
137137
matrix:
138138
os: [ubuntu-latest]
139-
scala: [2.13.8]
139+
scala: [2.13.10]
140140
java: [temurin@11]
141141
runs-on: ${{ matrix.os }}
142142
steps:
@@ -189,32 +189,22 @@ jobs:
189189
~/Library/Caches/Coursier/v1
190190
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
191191

192-
- name: Download target directories (2.12.16, rootJVM)
192+
- name: Download target directories (2.12.17, rootJVM)
193193
uses: actions/download-artifact@v2
194194
with:
195-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootJVM
195+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJVM
196196

197-
- name: Inflate target directories (2.12.16, rootJVM)
197+
- name: Inflate target directories (2.12.17, rootJVM)
198198
run: |
199199
tar xf targets.tar
200200
rm targets.tar
201201
202-
- name: Download target directories (2.13.8, rootJVM)
202+
- name: Download target directories (2.13.10, rootJVM)
203203
uses: actions/download-artifact@v2
204204
with:
205-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM
205+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJVM
206206

207-
- name: Inflate target directories (2.13.8, rootJVM)
208-
run: |
209-
tar xf targets.tar
210-
rm targets.tar
211-
212-
- name: Download target directories (2.13.8, rootJVM)
213-
uses: actions/download-artifact@v2
214-
with:
215-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM
216-
217-
- name: Inflate target directories (2.13.8, rootJVM)
207+
- name: Inflate target directories (2.13.10, rootJVM)
218208
run: |
219209
tar xf targets.tar
220210
rm targets.tar
@@ -241,14 +231,14 @@ jobs:
241231
(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)
242232
243233
- name: Publish
244-
run: sbt '++${{ matrix.scala }}' tlRelease
234+
run: sbt '++ ${{ matrix.scala }}' tlRelease
245235

246236
site:
247237
name: Generate Site
248238
strategy:
249239
matrix:
250240
os: [ubuntu-latest]
251-
scala: [2.13.8]
241+
scala: [2.13.10]
252242
java: [temurin@11]
253243
runs-on: ${{ matrix.os }}
254244
steps:
@@ -302,7 +292,7 @@ jobs:
302292
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
303293

304294
- name: Generate site
305-
run: sbt '++${{ matrix.scala }}' docs/tlSite
295+
run: sbt '++ ${{ matrix.scala }}' docs/tlSite
306296

307297
- name: Publish site
308298
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'

.scala-steward.conf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@ updates.pin = [
55

66
updates.ignore = [
77
# Inherit from series/0.23
8-
{ groupId = "org.http4s", artifactId = "sbt-http4s-org" }
8+
{ groupId = "org.http4s", artifactId = "http4s-dsl" },
9+
{ groupId = "org.http4s", artifactId = "http4s-server" },
10+
{ groupId = "org.http4s", artifactId = "http4s-scalafix-internal" },
11+
{ groupId = "org.http4s", artifactId = "sbt-http4s-org" },
12+
{ groupId = "org.scala-lang", artifactId = "scala3-library" },
13+
{ groupId = "org.scala-sbt", artifactId = "sbt" }
914
]

.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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Runs http4s apps as Java servlets. Provides components for the [http4s-jetty][h
88

99
```scala
1010
libraryDependencies ++= Seq(
11-
"org.http4s" %% "http4s-servlet" % http4sScalatagsV
11+
"org.http4s" %% "http4s-servlet" % http4sServletV
1212
)
1313
```
1414

build.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ ThisBuild / developers := List(
1010
// publish website from this branch
1111
ThisBuild / tlSitePublishBranch := Some("main")
1212

13-
val Scala213 = "2.13.8"
14-
ThisBuild / crossScalaVersions := Seq("2.12.16", Scala213, "3.2.1")
13+
val Scala213 = "2.13.10"
14+
ThisBuild / crossScalaVersions := Seq("2.12.17", Scala213, "3.2.1")
1515
ThisBuild / scalaVersion := Scala213 // the default Scala
1616

1717
// Jetty 10+, for testing, requires Java 11.
@@ -22,7 +22,7 @@ lazy val root = tlCrossRootProject.aggregate(servlet, examples)
2222

2323
val asyncHttpClientVersion = "2.12.3"
2424
val jettyVersion = "11.0.13"
25-
val http4sVersion = "0.23.12"
25+
val http4sVersion = "0.23.17"
2626
val munitCatsEffectVersion = "1.0.7"
2727
val servletApiVersion = "5.0.0"
2828

examples/src/main/scala/com/example/Bootstrap.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class Bootstrap extends ServletContextListener {
3939
@volatile private var shutdown: IO[Unit] = IO.unit
4040

4141
override def contextInitialized(sce: ServletContextEvent): Unit = {
42-
Dispatcher[IO].allocated
42+
Dispatcher
43+
.parallel[IO]
44+
.allocated
4345
.flatMap { case (dispatcher, shutdown) =>
4446
IO(this.shutdown = shutdown) *>
4547
IO(sce.getServletContext.mountRoutes("example", routes, dispatcher = dispatcher))

flake.lock

Lines changed: 12 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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,2 +1,2 @@
11
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
2-
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.14.3")
2+
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.14.9")

servlet/src/main/scala/org/http4s/servlet/AsyncHttp4sServlet.scala

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ import jakarta.servlet.http.HttpServletRequest
2626
import jakarta.servlet.http.HttpServletResponse
2727
import org.http4s.server._
2828

29+
import scala.annotation.nowarn
2930
import scala.concurrent.duration.Duration
3031

31-
class AsyncHttp4sServlet[F[_]](
32-
service: HttpApp[F],
32+
class AsyncHttp4sServlet[F[_]] @deprecated("Use AsyncHttp4sServlet.builder", "0.23.17") (
33+
httpApp: HttpApp[F],
3334
asyncTimeout: Duration = Duration.Inf,
3435
servletIo: ServletIo[F],
3536
serviceErrorHandler: ServiceErrorHandler[F],
3637
dispatcher: Dispatcher[F],
3738
)(implicit F: Async[F])
38-
extends Http4sServlet[F](service, servletIo, dispatcher) {
39+
extends Http4sServlet[F](httpApp, servletIo, dispatcher) {
3940
private val asyncTimeoutMillis =
4041
if (asyncTimeout.isFinite) asyncTimeout.toMillis else -1 // -1 == Inf
4142

@@ -131,16 +132,60 @@ class AsyncHttp4sServlet[F[_]](
131132
}
132133

133134
object AsyncHttp4sServlet {
135+
136+
class Builder[F[_]] private[AsyncHttp4sServlet] (
137+
httpApp: HttpApp[F],
138+
dispatcher: Dispatcher[F],
139+
asyncTimeout: Option[Duration],
140+
chunkSize: Option[Int],
141+
) {
142+
private def copy(
143+
httpApp: HttpApp[F] = httpApp,
144+
dispatcher: Dispatcher[F] = dispatcher,
145+
asyncTimeout: Option[Duration] = asyncTimeout,
146+
chunkSize: Option[Int] = chunkSize,
147+
): Builder[F] =
148+
new Builder[F](
149+
httpApp,
150+
dispatcher,
151+
asyncTimeout,
152+
chunkSize,
153+
) {}
154+
155+
@nowarn("cat=deprecation")
156+
def build(implicit F: Async[F]): AsyncHttp4sServlet[F] =
157+
new AsyncHttp4sServlet(
158+
httpApp,
159+
asyncTimeout.getOrElse(Duration.Inf),
160+
NonBlockingServletIo(chunkSize.getOrElse(DefaultChunkSize)),
161+
DefaultServiceErrorHandler,
162+
dispatcher,
163+
)
164+
165+
def withHttpApp(httpApp: HttpApp[F]): Builder[F] =
166+
copy(httpApp = httpApp)
167+
168+
def withDispatcher(dispatcher: Dispatcher[F]): Builder[F] =
169+
copy(dispatcher = dispatcher)
170+
171+
def withAsyncTimeout(asyncTimeout: Duration): Builder[F] =
172+
copy(asyncTimeout = Some(asyncTimeout))
173+
174+
def withChunkSize(chunkSize: Int): Builder[F] =
175+
copy(chunkSize = Some(chunkSize))
176+
}
177+
178+
def builder[F[_]](httpApp: HttpApp[F], dispatcher: Dispatcher[F]): Builder[F] =
179+
new Builder[F](httpApp, dispatcher, None, None) {}
180+
181+
@deprecated("Use `builder`. `service` is renamed to `httpApp`.", "0.22.13")
134182
def apply[F[_]: Async](
135183
service: HttpApp[F],
136184
asyncTimeout: Duration = Duration.Inf,
137185
dispatcher: Dispatcher[F],
138186
): AsyncHttp4sServlet[F] =
139-
new AsyncHttp4sServlet[F](
140-
service,
141-
asyncTimeout,
142-
NonBlockingServletIo[F](DefaultChunkSize),
143-
DefaultServiceErrorHandler,
144-
dispatcher,
145-
)
187+
AsyncHttp4sServlet
188+
.builder[F](service, dispatcher)
189+
.withAsyncTimeout(asyncTimeout)
190+
.build
146191
}

0 commit comments

Comments
 (0)