diff --git a/bench/src/main/scala/routing/bench/Http4sBenchmark.scala b/bench/src/main/scala/routing/bench/Http4sBenchmark.scala index 0d32dd3..3bf31f7 100644 --- a/bench/src/main/scala/routing/bench/Http4sBenchmark.scala +++ b/bench/src/main/scala/routing/bench/Http4sBenchmark.scala @@ -2,7 +2,7 @@ package routing package bench import cats.effect.IO -import cats.effect.unsafe.implicits.global // 0.23, 1.0.0-M39 +import cats.effect.unsafe.implicits.global // 0.23, 1.0.0-M40 import org.http4s._ import org.http4s.dsl.io._ import org.openjdk.jmh.annotations._ @@ -38,7 +38,7 @@ object http4sHelper extends BenchmarkHelper[Request[IO], Request[IO] => IO[Respo class Http4sBenchmark_0_22 { // 0.22 class Http4sBenchmark_0_23 { // 0.23 -class Http4sBenchmark_1_0_0_M39 { // 1.0.0-M39 +class Http4sBenchmark_1_0_0_M40 { // 1.0.0-M40 import http4sHelper._ @Benchmark def http4s: String = run(http4sService) diff --git a/bench/src/main/scala/routing/bench/PlayBenchmark.scala b/bench/src/main/scala/routing/bench/PlayBenchmark.scala index eec9157..c0d920a 100644 --- a/bench/src/main/scala/routing/bench/PlayBenchmark.scala +++ b/bench/src/main/scala/routing/bench/PlayBenchmark.scala @@ -1,4 +1,4 @@ -// ++ 1.0.0-M39 +// ++ 1.0.0-M40 package routing package bench @@ -17,4 +17,4 @@ class PlayBenchmark { @Benchmark def routing: String = run(routingService) @Benchmark def routingManual: String = run(routingManualService) } -// -- 1.0.0-M39 +// -- 1.0.0-M40 diff --git a/bench/src/main/scala/routing/bench/PlayBenchmarkHelper.scala b/bench/src/main/scala/routing/bench/PlayBenchmarkHelper.scala index cc7167e..db965fb 100644 --- a/bench/src/main/scala/routing/bench/PlayBenchmarkHelper.scala +++ b/bench/src/main/scala/routing/bench/PlayBenchmarkHelper.scala @@ -31,7 +31,7 @@ object PlayBenchmarkHelper extends BenchmarkHelper[RequestHeader, Handler, Route def request(r: Route[_ <: Method, _]): RequestHeader = new RequestHeader { - def attrs = TypedMap.empty + def attrs: TypedMap = TypedMap.empty def connection: RemoteConnection = RemoteConnection("", false, None) def headers: Headers = Headers() def method: String = r.method.name diff --git a/build.sbt b/build.sbt index 06a86b7..7a04500 100644 --- a/build.sbt +++ b/build.sbt @@ -47,13 +47,13 @@ lazy val http4s = http4sProj(projectMatrix.in(file("http4s")), "http4s")(axis => lazy val play = simpleProj(projectMatrix.in(file("play")), "play", List(Platform.Jvm)) .settings(publishSettings) - .settings(libraryDependencies += playCore("2.8.18").value cross CrossVersion.for3Use2_13) + .settings(libraryDependencies += playCore("2.8.20").value cross CrossVersion.for3Use2_13) .dependsOn(core % "compile->compile;test->test") lazy val play2_9 = { lazy val play2_9 = simpleProj(projectMatrix.in(file("play2_9")), "play2_9", List(Platform.Jvm), modScalaVersions = _ => _.filterNot(_.startsWith("2.12"))) .settings(publishSettings) - .settings(libraryDependencies += playCore("2.9.0-M6").value) + .settings(libraryDependencies += playCore("2.9.0-RC1").value) .dependsOn(core % "compile->compile;test->test") if (System.getProperty("java.version").startsWith("1.8")) play2_9 else play2_9.settings( @@ -67,6 +67,7 @@ lazy val bench = http4sProj(projectMatrix.in(file("bench")), "bench", _ => List( modScalaVersions = _ => _ => _.filterNot(_.startsWith("3.")), ) .settings(noPublishSettings) + .settings(scalacOptions --= foldScalaV(scalaVersion.value)(Seq("-Ywarn-unused:nowarn"), Seq(), Seq())) .dependsOn(core, http4s, play) .enablePlugins(JmhPlugin) @@ -77,6 +78,7 @@ def http4sImplDoc(dir: File, axis: Http4sAxis.Value): (File, String) = lazy val docs = http4sProj(projectMatrix.in(file("routing-docs")), "routing-docs", _ => List(Platform.Jvm))( axis => _ => _.settings( + scalacOptions -= "-Xfatal-warnings", mdocVariables ++= Map( "VERSION" -> currentVersion, "GITHUB_REPO_URL" -> githubRepoUrl, @@ -86,14 +88,14 @@ lazy val docs = http4sProj(projectMatrix.in(file("routing-docs")), "routing-docs "HTTP4S_PATH_CODE" -> (axis match { case Http4sAxis.v0_22 | Http4sAxis.v0_23 | - Http4sAxis.v1_0_0_M39 => + Http4sAxis.v1_0_0_M40 => "Uri.Path.unsafeFromString(path)" }), "HTTP4S_UNSAFERUNSYNC_IMPORT" -> (axis match { - case Http4sAxis.v0_23 | Http4sAxis.v1_0_0_M39 => "import cats.effect.unsafe.implicits.global\n" + case Http4sAxis.v0_23 | Http4sAxis.v1_0_0_M40 => "import cats.effect.unsafe.implicits.global\n" case _ => "" }) - ) + ), ), ).enablePlugins(MdocPlugin) .settings(noPublishSettings) @@ -146,7 +148,7 @@ lazy val example = http4sProj(projectMatrix.in(file("example")), "example", _ => http4sDep("circe", axis.version).value, http4sDep("blaze-server", axis match { case Http4sAxis.v0_23 => s"${axis.suffix}.12" - case Http4sAxis.v1_0_0_M39 => s"${axis.suffix.dropRight(1)}6" + case Http4sAxis.v1_0_0_M40 => s"${axis.suffix.dropRight(2)}38" case _ => axis.version }).value, ), diff --git a/core/src/main/scala/routing/Route.scala b/core/src/main/scala/routing/Route.scala index 1f93754..91b5720 100644 --- a/core/src/main/scala/routing/Route.scala +++ b/core/src/main/scala/routing/Route.scala @@ -89,10 +89,10 @@ object Route { lazy val show = Shown(Vector(), Vector()) - def pathParts(u: Unit) = Vector() - def queryParts(u: Unit) = Vector() + def pathParts(u: Unit): Vector[PathPart] = Vector() + def queryParts(u: Unit): Vector[QueryPart] = Vector() - lazy val components = Vector() + lazy val components: Vector[Component] = Vector() def matchUri[ForwardPath, ForwardQuery](path: ForwardPath, query: ForwardQuery)( implicit P: ExtractPathPart[ForwardPath], diff --git a/core/src/test/scala/routing/builder/CodecSpec.scala b/core/src/test/scala/routing/builder/CodecSpec.scala index 01a6c24..12a96c7 100644 --- a/core/src/test/scala/routing/builder/CodecSpec.scala +++ b/core/src/test/scala/routing/builder/CodecSpec.scala @@ -5,6 +5,8 @@ import org.scalacheck.Prop.{forAll, propBoolean} import routing.extractor.ExtractRequest abstract class CodecSpec(name: String) extends Properties(s"$name.codec") { + implicit class PipeOps[A](a: A) { final def |>[B](f: A => B): B = f(a) } + def matches[A](tpe: String, expected: A, actual: A): Prop = (expected == actual) :| s"$tpe mismatch\n expected: $expected\n actual: $actual" @@ -80,8 +82,9 @@ abstract class CodecSpec(name: String) extends Properties(s"$name.codec") { def testPath() = pathEncodedChars.foreach { case (raw, encoded) => - property(s"decodes '$raw' in path") = forAll((s: Str) => - testDecode(pathRoute)(x => ReverseUri(Method.GET, s"/$x", Vector()), s, raw, encoded)) + property.update(s"decodes '$raw' in path", forAll((s: Str) => + testDecode(pathRoute)(x => ReverseUri(Method.GET, s"/$x", Vector()), s, raw, encoded) + )) |> (_ => ()) property(s"encodes '$raw' in path") = forAll((s: Str) => testEncode(pathRoute)(s => s"/$s", s, raw, encoded)) diff --git a/example/src/main/scala/routing/example/App.scala b/example/src/main/scala/routing/example/App.scala index 2e7b8c0..572ccbc 100644 --- a/example/src/main/scala/routing/example/App.scala +++ b/example/src/main/scala/routing/example/App.scala @@ -1,13 +1,13 @@ package routing.example import cats.effect.{ExitCode, IO, IOApp} -import org.http4s.blaze.server.BlazeServerBuilder // 0.22, 0.23, 1.0.0-M39 +import org.http4s.blaze.server.BlazeServerBuilder import scala.concurrent.ExecutionContext // 0.22 object App extends IOApp { override def run(args: List[String]): IO[ExitCode] = BlazeServerBuilder[IO](ExecutionContext.global) // 0.22 - BlazeServerBuilder[IO] // 0.23, 1.0.0-M39 + BlazeServerBuilder[IO] // 0.23, 1.0.0-M40 .bindHttp(8080, "localhost") .withHttpApp(Controller.actions.orNotFound) .serve diff --git a/http4s/src/main/scala/routing/http4s/Syntax.scala b/http4s/src/main/scala/routing/http4s/Syntax.scala index 4649dd8..a2041d6 100644 --- a/http4s/src/main/scala/routing/http4s/Syntax.scala +++ b/http4s/src/main/scala/routing/http4s/Syntax.scala @@ -3,7 +3,7 @@ package http4s import cats.Applicative import cats.Defer // 0.22 -import cats.Monad // 0.23, 1.0.0-M39 +import cats.Monad // 0.23, 1.0.0-M40 import cats.data.OptionT import org.{http4s => h} import scala.annotation.tailrec @@ -27,7 +27,7 @@ object syntax { implicit class Http4sReverseUriOps(val uri: ReverseUri) extends AnyVal { def toHttp4s: h.Uri = - h.Uri(path = h.Uri.Path.unsafeFromString(uri.path), query = new Http4sReverseQueryOps(uri.query).toHttp4s) // 0.22, 0.23, 1.0.0-M39 + h.Uri(path = h.Uri.Path.unsafeFromString(uri.path), query = new Http4sReverseQueryOps(uri.query).toHttp4s) } @tailrec @@ -46,7 +46,7 @@ object syntax { implicit class Http4sRouteObjectOps(private val route: Route.type) extends AnyVal { def httpRoutes[F[_]: Applicative: Defer]( // 0.22 - def httpRoutes[F[_]: Monad]( // 0.23, 1.0.0-M39 + def httpRoutes[F[_]: Monad]( // 0.23, 1.0.0-M40 handlers: Handled[h.Request[F] => F[h.Response[F]]]* ): h.HttpRoutes[F] = h.HttpRoutes[F](tryRoutes(_, handlers.toList)) diff --git a/play/src/test/scala/routing/play/CodecSpec.scala b/play/src/test/scala/routing/play/CodecSpec.scala index 6fd635a..b7e7f2e 100644 --- a/play/src/test/scala/routing/play/CodecSpec.scala +++ b/play/src/test/scala/routing/play/CodecSpec.scala @@ -12,7 +12,7 @@ object CodecSpec extends routing.CodecSpec("play") { def mkReq(u: ReverseUri): Request = new RequestHeader { - def attrs = TypedMap.empty + def attrs: TypedMap = TypedMap.empty def connection: RemoteConnection = RemoteConnection("", false, None) def headers: Headers = Headers() def method: String = "GET" diff --git a/project/Build.scala b/project/Build.scala index f35af97..f84724d 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -10,7 +10,7 @@ import sbtprojectmatrix.ProjectMatrixPlugin.autoImport._ import scala.sys.process._ object Build { - lazy val scalaVersions = Seq("2.12.17", "2.13.10", "3.3.0") + lazy val scalaVersions = Seq("2.12.18", "2.13.12", "3.3.1") lazy val latestScalaV = scalaVersions.find(_.startsWith("3.")).get lazy val kindProjector = compilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full) @@ -127,9 +127,7 @@ object Build { } def sjsProj(f: Project => Project): Project => Project = - f.andThen(_.settings( - scalacOptions ++= foldScalaV(scalaVersion.value)(Seq(), Seq(), Seq("-scalajs")), - ).enablePlugins(org.scalajs.sbtplugin.ScalaJSPlugin)) + f.andThen(_.enablePlugins(org.scalajs.sbtplugin.ScalaJSPlugin)) def platformAxes(platforms: List[Platform]): List[(Platform, VirtualAxis)] = platforms.map { @@ -195,7 +193,7 @@ object Build { val defaultHttp4sPlatforms = (_: Http4sAxis.Value) match { case Http4sAxis.v0_22 => List(Platform.Jvm) - case Http4sAxis.v0_23 | Http4sAxis.v1_0_0_M39 => List(Platform.Jvm, Platform.Js) + case Http4sAxis.v0_23 | Http4sAxis.v1_0_0_M40 => List(Platform.Jvm, Platform.Js) } def http4sProj(matrix: ProjectMatrix, nme: String, platforms: Http4sAxis.Value => List[Platform] = defaultHttp4sPlatforms)( @@ -225,7 +223,7 @@ object Build { } ))), modScalaVersions = axis => platform => versions => axis match { - case Http4sAxis.v1_0_0_M39 => modScalaVersions(axis)(platform)(versions.filterNot(_.startsWith("2.12"))) + case Http4sAxis.v1_0_0_M40 => modScalaVersions(axis)(platform)(versions.filterNot(_.startsWith("2.12"))) case _ => modScalaVersions(axis)(platform)(versions) }, ) @@ -241,8 +239,8 @@ object Build { .getOrElse(Seq()) ) - val catsCore = Def.setting("org.typelevel" %%% "cats-core" % "2.9.0") - val izumiReflect = Def.setting("dev.zio" %%% "izumi-reflect" % "2.2.3") + val catsCore = Def.setting("org.typelevel" %%% "cats-core" % "2.10.0") + val izumiReflect = Def.setting("dev.zio" %%% "izumi-reflect" % "2.3.8") val http4sV1Milestone = "1.0.0-M" object Http4sAxis extends Enumeration { @@ -259,8 +257,8 @@ object Build { implicit def valueToVirtualAxis(v: Value): VirtualAxis.WeakAxis = v.axis val v0_22 = HAVal("0.22", "0.22.15", "latest stable on cats effect 2") - val v0_23 = HAVal("0.23", "0.23.17", "latest stable on cats effect 3") - val v1_0_0_M39 = HAVal(s"${http4sV1Milestone}39", s"${http4sV1Milestone}39", "latest development on cats effect 3") + val v0_23 = HAVal("0.23", "0.23.23", "latest stable on cats effect 3") + val v1_0_0_M40 = HAVal(s"${http4sV1Milestone}40", s"${http4sV1Milestone}40", "latest development on cats effect 3") lazy val all = values.toList } diff --git a/project/build.properties b/project/build.properties index 72413de..51b51fc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.3 +sbt.version=1.9.5 diff --git a/project/plugins.sbt b/project/plugins.sbt index 844b8d7..4b36b06 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,10 +1,10 @@ addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.0") -addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.1") -addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.1") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.12") -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6" ) -addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3") +addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.0") +addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.15") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7" ) +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") resolvers += "bondlink-maven-repo" at "https://raw.githubusercontent.com/mblink/maven-repo/main" addSbtPlugin("bondlink" % "sbt-git-publish" % "0.0.5") diff --git a/website/i18n/en.json b/website/i18n/en.json index 378d43f..3f3c7c5 100644 --- a/website/i18n/en.json +++ b/website/i18n/en.json @@ -20,8 +20,8 @@ "implementations/http4s-0.23": { "title": "http4s 0.23 (latest stable on cats effect 3)" }, - "implementations/http4s-1.0.0-M39": { - "title": "http4s 1.0.0-M39 (latest development on cats effect 3)" + "implementations/http4s-1.0.0-M40": { + "title": "http4s 1.0.0-M40 (latest development on cats effect 3)" }, "implementations/play": { "title": "Play Framework" diff --git a/website/sidebars.json b/website/sidebars.json index 95a793f..f49863f 100755 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -11,7 +11,7 @@ "implementations", "implementations/http4s-0.22", "implementations/http4s-0.23", - "implementations/http4s-1.0.0-M39", + "implementations/http4s-1.0.0-M40", "implementations/play" ] },