diff --git a/build.sbt b/build.sbt index 7152fa5c6..eb89f47f8 100644 --- a/build.sbt +++ b/build.sbt @@ -44,8 +44,10 @@ inThisBuild(Def.settings( concurrentRestrictions in Global += Tags.limit(Tags.Test, 1), onLoad in Global := { sLog.value.info( - s"Building Pekko HTTP ${version.value} against Pekko ${PekkoCoreDependency.version} on Scala ${(httpCore / - scalaVersion).value}") + s"Building Pekko HTTP ${version.value} against Pekko ${PekkoCoreDependency.version} on Scala ${ + (httpCore / + scalaVersion).value + }") (onLoad in Global).value }, projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value), @@ -71,7 +73,7 @@ lazy val userProjects: Seq[ProjectReference] = List[ProjectReference]( lazy val aggregatedProjects: Seq[ProjectReference] = userProjects ++ List[ProjectReference]( httpTests, docs, - // compatibilityTests, + compatibilityTests, httpJmhBench, billOfMaterials) lazy val root = Project( @@ -82,9 +84,8 @@ lazy val root = Project( .settings( name := "pekko-http-root", // Unidoc doesn't like macro definitions - // compatibilityTests temporarily disabled - unidocProjectExcludes := Seq(parsing, docs, httpTests, httpJmhBench, httpScalafix, httpScalafixRules, - httpScalafixTestInput, httpScalafixTestOutput, httpScalafixTests), + unidocProjectExcludes := Seq(parsing, compatibilityTests, docs, httpTests, httpJmhBench, httpScalafix, + httpScalafixRules, httpScalafixTestInput, httpScalafixTestOutput, httpScalafixTests), // Support applying macros in unidoc: scalaMacroSupport, Compile / headerCreate / unmanagedSources := (baseDirectory.value / "project").**("*.scala").get) @@ -434,14 +435,13 @@ lazy val docs = project("docs") ValidatePR / additionalTasks += Compile / paradox) .settings(ParadoxSupport.paradoxWithCustomDirectives) -/* lazy val compatibilityTests = Project("http-compatibility-tests", file("http-compatibility-tests")) - .enablePlugins(NoPublish, NoScala3) + .enablePlugins(NoPublish) .disablePlugins(MimaPlugin) .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default) .settings( libraryDependencies ++= Seq( - "org.apache.pekko" %% "pekko-http" % MiMa.latest101Version % "provided", + "org.apache.pekko" %% "pekko-http" % "1.0.0" % "provided" ), (Test / dependencyClasspath) := { // HACK: We'd like to use `dependsOn(http % "test->compile")` to upgrade the explicit dependency above to the @@ -450,7 +450,6 @@ lazy val compatibilityTests = Project("http-compatibility-tests", file("http-com (httpTests / Test / fullClasspath).value } ) - */ lazy val billOfMaterials = Project("bill-of-materials", file("bill-of-materials")) .enablePlugins(BillOfMaterialsPlugin) diff --git a/http-compatibility-tests/src/main/scala/example/HostConnectionPoolCompat.scala b/http-compatibility-tests/src/main/scala/example/HostConnectionPoolCompat.scala deleted file mode 100644 index abb4cffbd..000000000 --- a/http-compatibility-tests/src/main/scala/example/HostConnectionPoolCompat.scala +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2020-2022 Lightbend Inc. - */ - -package example - -import org.apache.pekko.http.scaladsl.Http.HostConnectionPool - -object HostConnectionPoolCompat { - def access(hcp: HostConnectionPool): Unit = { - val theSetup = hcp.setup - hcp.shutdown() - - hcp match { - // This still works because case class matching does not require an unapply method - case HostConnectionPool(setup) => require(setup == theSetup) - } - - require(hcp.productArity == 1) - require(hcp.productElement(0) == hcp.setup) - require(hcp.canEqual(hcp)) - require(hcp.equals(hcp)) - - // Companion object is still there, even if had no good public use - HostConnectionPool - - // This one didn't compile even before (private[http] constructor) - // new HostConnectionPool(hcp.setup)(null) - - // This line compiles but only by giving null as the PoolGateway parameter which was private before - // This would crash now - // HostConnectionPool(hcp.setup)(null) - - // These lines compile but require nulling out the gateway parameter - // They would crash now. - // hcp.copy(setup = hcp.setup)(null) - // hcp.copy()(null) - - // This compiles but crashes now but is unlikely user code - // val Some(setup) = HostConnectionPool.unapply(hcp) - } -} diff --git a/http-compatibility-tests/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/CompatFormField.scala b/http-compatibility-tests/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/CompatFormField.scala index 71f14f531..fea4688c1 100644 --- a/http-compatibility-tests/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/CompatFormField.scala +++ b/http-compatibility-tests/src/main/scala/org/apache/pekko/http/scaladsl/server/directives/CompatFormField.scala @@ -19,15 +19,9 @@ import Directives._ object CompatFormField { def oneParameter: Directive1[Int] = formField("num".as[Int]) + def oneParameterRoute: Route = oneParameter { num => complete(num.toString) } - - def twoParameters: Directive[(String, Int)] = - formFields(("name", "age".as[Int])) - def twoParametersRoute: Route = - twoParameters { (name, age) => - complete(s"$name $age") - } } diff --git a/http-compatibility-tests/src/test/scala/org/apache/pekko/http/scaladsl/HostConnectionPoolCompatSpec.scala b/http-compatibility-tests/src/test/scala/org/apache/pekko/http/scaladsl/HostConnectionPoolCompatSpec.scala deleted file mode 100644 index 8e91ead0e..000000000 --- a/http-compatibility-tests/src/test/scala/org/apache/pekko/http/scaladsl/HostConnectionPoolCompatSpec.scala +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * license agreements; and to You under the Apache License, version 2.0: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * This file is part of the Apache Pekko project, which was derived from Akka. - */ - -/* - * Copyright (C) 2020-2022 Lightbend Inc. - */ - -package org.apache.pekko.http.scaladsl - -import org.apache.pekko -import pekko.http.impl.util.PekkoSpecWithMaterializer -import pekko.stream.scaladsl.{ Keep, Sink, Source } -import example.HostConnectionPoolCompat - -class HostConnectionPoolCompatSpec extends PekkoSpecWithMaterializer { - "HostConnectionPool" should { - "be compatible" in { - val hcp0 = - Source.empty - .viaMat(Http().cachedHostConnectionPool("localhost", 8080))(Keep.right) - .to(Sink.ignore) - .run() - - val hcp1 = - Source.empty - .viaMat(Http().cachedHostConnectionPool("localhost", 8080))(Keep.right) - .to(Sink.ignore) - .run() - - val hcpOther = - Source.empty - .viaMat(Http().newHostConnectionPool("localhost", 8080))(Keep.right) - .to(Sink.ignore) - .run() - - hcp0 shouldEqual hcp1 - (hcp0 should not).equal(hcpOther) - - HostConnectionPoolCompat.access(hcp0) - } - } -} diff --git a/http-compatibility-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/CompatFormFieldSpec.scala b/http-compatibility-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/CompatFormFieldSpec.scala index 0d6f107f8..29dae4430 100644 --- a/http-compatibility-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/CompatFormFieldSpec.scala +++ b/http-compatibility-tests/src/test/scala/org/apache/pekko/http/scaladsl/server/directives/CompatFormFieldSpec.scala @@ -30,18 +30,8 @@ class CompatFormFieldSpec extends RoutingSpec { responseAs[String] shouldEqual "12" } } - "for two parameters" in { - val req = Post("/", FormData("name" -> "Aloisia", "age" -> "12")) - req ~> CompatFormField.twoParameters(echoComplete2) ~> check { - responseAs[String] shouldEqual "Aloisia 12" - } - - req ~> CompatFormField.twoParametersRoute ~> check { - responseAs[String] shouldEqual "Aloisia 12" - } - } } else - "ignore incompatiblity in 2.13" in succeed + "ignore incompatibility in 2.13" in succeed "FormFieldDirectives" should { "be compatible" should {