Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 0.23 -> main #708

Merged
merged 15 commits into from
Jul 7, 2022
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 @@ -97,11 +97,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 blaze-client/target blaze-server/target target examples/target http/target blaze-core/target core/target testkit/target project/target
run: mkdir -p blaze-client/target target blaze-server/target examples/target http/target core/target blaze-core/target testkit/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 blaze-client/target blaze-server/target target examples/target http/target blaze-core/target core/target testkit/target project/target
run: tar cf targets.tar blaze-client/target target blaze-server/target examples/target http/target core/target blaze-core/target testkit/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
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ private[http4s] trait EntityBodyWriter[F[_]] {
* If it errors the error stream becomes the stream, which performs an
* exception flush and then the stream fails.
*/
private def writePipe(s: Stream[F, Byte]): Stream[F, INothing] = {
private def writePipe(s: Stream[F, Byte]): Stream[F, Nothing] = {
def writeChunk(chunk: Chunk[Byte]): F[Unit] =
fromFutureNoShift(F.delay(writeBodyChunk(chunk, flush = false)))

val writeStream: Stream[F, INothing] =
val writeStream: Stream[F, Nothing] =
s.repeatPull {
_.uncons.flatMap {
case None => Pull.pure(None)
case Some((hd, tl)) => Pull.eval(writeChunk(hd)).as(Some(tl))
}
}

val errorStream: Throwable => Stream[F, INothing] = e =>
val errorStream: Throwable => Stream[F, Nothing] = e =>
Stream
.eval(fromFutureNoShift(F.delay(exceptionFlush())))
.flatMap(_ => Stream.raiseError[F](e))
Expand Down
15 changes: 15 additions & 0 deletions blaze-core/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n${LOGBACK_EXCEPTION_PATTERN:-%throwable}</pattern>
</encoder>
</appender>

<!-- Configurable via the env variable -->
<root level="${LOGBACK_ROOT_LEVEL:-INFO}">
<appender-ref ref="STDOUT" />
</root>
</configuration>
60 changes: 28 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ ThisBuild / developers ++= List(
"bryce-anderson",
"Bryce L. Anderson",
"[email protected]",
url("https://github.com/bryce-anderson")
url("https://github.com/bryce-anderson"),
),
Developer(
"rossabaker",
"Ross A. Baker",
"[email protected]",
url("https://github.com/rossabaker")
url("https://github.com/rossabaker"),
),
Developer(
"ChristopherDavenport",
"Christopher Davenport",
"[email protected]",
url("https://github.com/ChristopherDavenport")
)
url("https://github.com/ChristopherDavenport"),
),
)
ThisBuild / startYear := Some(2014)

Expand All @@ -54,7 +54,7 @@ lazy val commonSettings = Seq(
},
run / fork := true,
scalafmtConfig := file(".scalafmt.blaze.conf"),
scalafixConfig := Some(file(".scalafix.blaze.conf"))
scalafixConfig := Some(file(".scalafix.blaze.conf")),
)

// currently only publishing tags
Expand All @@ -64,7 +64,7 @@ ThisBuild / githubWorkflowPublishTargetBranches :=
ThisBuild / githubWorkflowBuild ++= Seq(
WorkflowStep.Sbt(
List("${{ matrix.ci }}", "javafmtCheckAll"),
name = Some("Check Java formatting")
name = Some("Check Java formatting"),
)
)

Expand All @@ -73,6 +73,7 @@ lazy val blaze = project
.enablePlugins(Http4sOrgPlugin)
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.settings(scalafmtConfig := file(".scalafmt.conf"))
.aggregate(core, http, blazeCore, blazeServer, blazeClient, examples)

lazy val testkit = Project("blaze-testkit", file("testkit"))
Expand All @@ -92,15 +93,15 @@ lazy val core = Project("blaze-core", file("core"))
buildInfoKeys := Seq[BuildInfoKey](
version,
scalaVersion,
git.gitHeadCommit
git.gitHeadCommit,
),
buildInfoOptions += BuildInfoOption.BuildTime,
mimaBinaryIssueFilters ++= Seq(
// private constructor for which there are no sensible defaults
ProblemFilters.exclude[DirectMissingMethodProblem](
"org.http4s.blaze.channel.nio1.NIO1SocketServerGroup.this"
)
)
),
)
.dependsOn(testkit % Test)

Expand All @@ -122,20 +123,19 @@ lazy val http = Project("blaze-http", file("http"))
),
ProblemFilters.exclude[MissingClassProblem](
"org.http4s.blaze.http.http2.server.ALPNServerSelector$ServerProvider"
)
)
),
),
)
.dependsOn(testkit % Test, core % "test->test;compile->compile")

lazy val blazeCore = project
.in(file("blaze-core"))
lazy val blazeCore = Project("http4s-blaze-core", file("blaze-core"))
.settings(
name := "http4s-blaze-core",
description := "Base library for binding blaze to http4s clients and servers",
startYear := Some(2014),
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-core" % http4sVersion,
"org.typelevel" %% "munit-cats-effect-3" % munitCatsEffectVersion % Test
"org.typelevel" %% "munit-cats-effect-3" % munitCatsEffectVersion % Test,
logbackClassic % Test,
),
mimaBinaryIssueFilters := {
if (tlIsScala3.value)
Expand Down Expand Up @@ -164,23 +164,21 @@ lazy val blazeCore = project
ProblemFilters
.exclude[DirectMissingMethodProblem]("org.http4s.blazecore.util.IdentityWriter.this"),
ProblemFilters
.exclude[DirectMissingMethodProblem]("org.http4s.blazecore.util.IdentityWriter.ec")
.exclude[DirectMissingMethodProblem]("org.http4s.blazecore.util.IdentityWriter.ec"),
)
else Seq.empty
},
Test / scalafixConfig := Some(file(".scalafix.test.conf"))
Test / scalafixConfig := Some(file(".scalafix.test.conf")),
)
.dependsOn(http)

lazy val blazeServer = project
.in(file("blaze-server"))
lazy val blazeServer = Project("http4s-blaze-server", file("blaze-server"))
.settings(
name := "http4s-blaze-server",
description := "blaze implementation for http4s servers",
startYear := Some(2014),
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-server" % http4sVersion,
"org.http4s" %% "http4s-dsl" % http4sVersion % Test
"org.http4s" %% "http4s-dsl" % http4sVersion % Test,
),
mimaBinaryIssueFilters := Seq(
ProblemFilters.exclude[DirectMissingMethodProblem](
Expand Down Expand Up @@ -210,7 +208,7 @@ lazy val blazeServer = project
ProblemFilters
.exclude[DirectMissingMethodProblem]("org.http4s.blaze.server.BlazeServerBuilder.this"),
ProblemFilters
.exclude[DirectMissingMethodProblem]("org.http4s.blaze.server.WebSocketDecoder.this")
.exclude[DirectMissingMethodProblem]("org.http4s.blaze.server.WebSocketDecoder.this"),
) ++ {
if (tlIsScala3.value)
Seq(
Expand All @@ -227,23 +225,21 @@ lazy val blazeServer = project
),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"org.http4s.blaze.server.WebSocketSupport.webSocketKey"
)
),
)
else Seq.empty,
},
Test / scalafixConfig := Some(file(".scalafix.test.conf"))
Test / scalafixConfig := Some(file(".scalafix.test.conf")),
)
.dependsOn(blazeCore % "compile;test->test")

lazy val blazeClient = project
.in(file("blaze-client"))
lazy val blazeClient = Project("http4s-blaze-client", file("blaze-client"))
.settings(
name := "http4s-blaze-client",
description := "blaze implementation for http4s clients",
startYear := Some(2014),
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-client" % http4sVersion,
"org.http4s" %% "http4s-client-testkit" % http4sVersion % Test
"org.http4s" %% "http4s-client-testkit" % http4sVersion % Test,
),
mimaBinaryIssueFilters ++= Seq(
// private constructor
Expand Down Expand Up @@ -318,7 +314,7 @@ lazy val blazeClient = project
ProblemFilters
.exclude[IncompatibleResultTypeProblem]("org.http4s.blaze.client.Connection.isRecyclable"),
ProblemFilters
.exclude[ReversedMissingMethodProblem]("org.http4s.blaze.client.Connection.isRecyclable")
.exclude[ReversedMissingMethodProblem]("org.http4s.blaze.client.Connection.isRecyclable"),
) ++ {
if (tlIsScala3.value)
Seq(
Expand All @@ -328,7 +324,7 @@ lazy val blazeClient = project
)
else Seq.empty
},
Test / scalafixConfig := Some(file(".scalafix.test.conf"))
Test / scalafixConfig := Some(file(".scalafix.test.conf")),
)
.dependsOn(blazeCore % "compile;test->test")

Expand All @@ -340,9 +336,9 @@ lazy val examples = Project("blaze-examples", file("examples"))
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-dsl" % http4sVersion,
"org.http4s" %% "http4s-circe" % http4sVersion,
"io.circe" %% "circe-generic" % "0.14.2"
"io.circe" %% "circe-generic" % "0.14.2",
),
Test / scalafixConfig := Some(file(".scalafix.test.conf"))
Test / scalafixConfig := Some(file(".scalafix.test.conf")),
)
.dependsOn(blazeServer, blazeClient)

Expand All @@ -351,5 +347,5 @@ lazy val examples = Project("blaze-examples", file("examples"))
// use it in the local development process
addCommandAlias(
"validate",
";scalafmtCheckAll ;scalafmtSbtCheck ;javafmtCheckAll ;+test:compile ;test ;unusedCompileDependenciesTest ;mimaReportBinaryIssues"
";scalafmtCheckAll ;scalafmtSbtCheck ;javafmtCheckAll ;+test:compile ;test ;unusedCompileDependenciesTest ;mimaReportBinaryIssues",
)