Skip to content
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
48 changes: 48 additions & 0 deletions .github/scripts/resolve-scala-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

set -euo pipefail
Comment thread
He-Pin marked this conversation as resolved.

scala_version="${1:?scala version is required}"
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"

resolve_from_build() {
local pattern="$1"
local resolved
resolved="$(sed -n "$pattern" "$repo_root/project/Dependencies.scala")"
if [ -z "$resolved" ]; then
echo "Unable to resolve Scala version '$scala_version' from project/Dependencies.scala" >&2
exit 1
fi
printf '%s\n' "$resolved"
}

case "$scala_version" in
2.13 | 2.13.x | scala213)
resolve_from_build 's/.*val scala213Version = "\(.*\)".*/\1/p'
;;
3.3 | 3.3.x | scala3)
resolve_from_build 's/.*val scala3Version = "\(.*\)".*/\1/p'
;;
next)
resolve_from_build 's/.*val scala3NextVersion = "\(.*\)".*/\1/p'
;;
*)
printf '%s\n' "$scala_version"
;;
esac
18 changes: 14 additions & 4 deletions .github/workflows/validate-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
strategy:
fail-fast: false
matrix:
SCALA_VERSION: [2.13, 3.3]
SCALA_VERSION: [scala213, scala3, next]
JDK: [17]
steps:
- name: Checkout
Expand Down Expand Up @@ -101,17 +101,27 @@ jobs:
run: cp .jvmopts-ci .jvmopts

- name: Compile everything
run: sbt ++${{ matrix.SCALA_VERSION }} Test/compile
run: |-
scala_version="$(bash .github/scripts/resolve-scala-version.sh "${{ matrix.SCALA_VERSION }}")"
sbt "++${scala_version}!" Test/compile

# Quick testing for PR validation
- name: Validate pull request for JDK ${{ matrix.JDK }}, Scala ${{ matrix.SCALA_VERSION }}
if: ${{ github.event_name == 'pull_request' }}
run: sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} validatePullRequest
run: |-
scala_version="$(bash .github/scripts/resolve-scala-version.sh "${{ matrix.SCALA_VERSION }}")"
sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 "++${scala_version}!" validatePullRequest

# Full testing for pushes
- name: Run all tests JDK ${{ matrix.JDK }}, Scala ${{ matrix.SCALA_VERSION }}
if: ${{ github.event_name == 'push' }}
run: sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 ++${{ matrix.SCALA_VERSION }} mimaReportBinaryIssues test
run: |-
scala_version="$(bash .github/scripts/resolve-scala-version.sh "${{ matrix.SCALA_VERSION }}")"
if [ "${{ matrix.SCALA_VERSION }}" = "next" ]; then
sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 "++${scala_version}!" test
else
sbt -Dpekko.http.parallelExecution=false -Dpekko.test.timefactor=2 "++${scala_version}!" mimaReportBinaryIssues test
fi

- name: Upload test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
Expand Down
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ lazy val parsing = project("parsing")
.settings(AutomaticModuleName.settings("pekko.http.parsing"))
.addPekkoModuleDependency("pekko-actor", "provided", PekkoCoreDependency.default)
.settings(Dependencies.parsing)
.settings(scalacOptions ++= Common.notOnScala39Plus(Seq("-language:_")).value)
.settings(scalacOptions ++= Common.onlyOnScala2(Seq("-language:_")).value)
.settings(scalaMacroSupport)
.enablePlugins(ScaladocNoVerificationOfDiagrams)
.enablePlugins(ReproducibleBuildsPlugin)
Expand Down Expand Up @@ -140,7 +140,7 @@ lazy val http = project("http")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.settings(Dependencies.http)
.settings(
Compile / scalacOptions ++= Common.notOnScala39Plus(Seq("-language:_")).value)
Compile / scalacOptions ++= Common.onlyOnScala2(Seq("-language:_")).value)
.settings(scalaMacroSupport)
.enablePlugins(BootstrapGenjavadoc, BoilerplatePlugin)
.enablePlugins(ReproducibleBuildsPlugin)
Expand Down Expand Up @@ -195,7 +195,7 @@ lazy val httpTestkit = project("http-testkit")
.settings(
// don't ignore Suites which is the default for the junit-interface
testOptions += Tests.Argument(TestFrameworks.JUnit, "--ignore-runners="),
Compile / scalacOptions ++= Common.notOnScala39Plus(Seq("-language:_")).value,
Compile / scalacOptions ++= Common.onlyOnScala2(Seq("-language:_")).value,
Test / run / mainClass := Some("org.apache.pekko.http.javadsl.SimpleServerApp"))
.enablePlugins(BootstrapGenjavadoc, MultiNodeScalaTest, ScaladocNoVerificationOfDiagrams)
.enablePlugins(ReproducibleBuildsPlugin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@

// #extractActorSystem

@SuppressWarnings("unchecked")
public class BasicDirectivesExamplesTest extends JUnitJupiterRouteTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ abstract class MultiNodeSpec(val myself: RoleName, _system: ActorSystem, _roles:
ActorSystem(MultiNodeSpec.getCallerName(classOf[MultiNodeSpec]), ConfigFactory.load(config.config)),
config.roles, config.deployments)

val log: LoggingAdapter = Logging(system, this.getClass)(LogSource.fromClass)
private implicit val logSource: LogSource[Class[?]] = LogSource.fromClass
val log: LoggingAdapter = Logging(system, this.getClass)

/**
* Enrich `.await()` onto all Awaitables, using remaining duration from the innermost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.pekko.actor.ActorSystem;
import org.apache.pekko.http.javadsl.ServerBinding;

@SuppressWarnings("deprecation")
public class MinimalHttpApp extends HttpApp {

CompletableFuture<Done> shutdownTrigger = new CompletableFuture<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ abstract class DontLeakActorsOnFailingConnectionSpecs(poolImplementation: String
implicit val system: ActorSystem = ActorSystem("DontLeakActorsOnFailingConnectionSpecs-" + poolImplementation, config)
implicit val materializer: Materializer = Materializer.createMaterializer(system)

val log = Logging(system, getClass)(LogSource.fromClass)
private implicit val logSource: LogSource[Class[?]] = LogSource.fromClass
val log = Logging(system, getClass)

"Http.superPool" should {

Expand Down
18 changes: 9 additions & 9 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ object Common extends AutoPlugin {
"-Wconf:msg=pattern binding uses refutable extractor:s",
"-Wconf:msg=is more specialized than the right hand side:s",
"-Wconf:cat=deprecation:s")).value,
scalacOptions ++= onlyOnScala3Below39(Seq("-Yfuture-lazy-vals")).value,
scalacOptions ++= onlyOnScala38OrLater(Seq("-Wconf:any:s")).value,
scalacOptions ++= onlyOnScala33(Seq("-Yfuture-lazy-vals")).value,
javacOptions ++=
Seq("-encoding", "UTF-8", "--release", javacTarget),
mimaReportSignatureProblems := true,
Expand All @@ -77,16 +78,15 @@ object Common extends AutoPlugin {
def onlyOnScala3[T](values: Seq[T]): Def.Initialize[Seq[T]] = Def.setting {
if (scalaVersion.value.startsWith("3")) values else Seq.empty[T]
}
def onlyOnScala3Below39[T](values: Seq[T]): Def.Initialize[Seq[T]] = Def.setting {
if (scalaVersion.value.startsWith("3") && CrossVersion.partialVersion(scalaVersion.value).exists(_._2 < 9)) values
else Seq.empty[T]
def onlyOnScala33[T](values: Seq[T]): Def.Initialize[Seq[T]] = Def.setting {
if (scalaVersion.value.startsWith("3.3.")) values else Seq.empty[T]
}
def notOnScala39Plus[T](values: Seq[T]): Def.Initialize[Seq[T]] = Def.setting {
if (scalaVersion.value.startsWith("3") && CrossVersion.partialVersion(scalaVersion.value).exists(_._2 >= 9))
Seq.empty[T]
else values
def onlyOnScala38OrLater[T](values: Seq[T]): Def.Initialize[Seq[T]] = Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, minor)) if minor >= 8 => values
case _ => Seq.empty[T]
}
}

def scalaMinorVersion: Def.Initialize[Long] = Def.setting { CrossVersion.partialVersion(scalaVersion.value).get._2 }

}
9 changes: 5 additions & 4 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ object Dependencies {

val scala213Version = "2.13.18"
val scala3Version = "3.3.8"
val allScalaVersions = Seq(scala213Version, scala3Version)
val scala3NextVersion = "3.8.4"
val publishedScalaVersions = Seq(scala213Version, scala3Version)

val Versions = Seq(
crossScalaVersions := allScalaVersions,
scalaVersion := allScalaVersions.head)
crossScalaVersions := publishedScalaVersions,
scalaVersion := publishedScalaVersions.head)

object Provided {
val jsr305 = "com.google.code.findbugs" % "jsr305" % "3.0.2" % "provided"
Expand All @@ -65,7 +66,7 @@ object Dependencies {

val caffeine = "com.github.ben-manes.caffeine" % "caffeine" % "3.2.4"

val scalafix = "ch.epfl.scala" %% "scalafix-core" % Dependencies.scalafixVersion
val scalafix = ("ch.epfl.scala" %% "scalafix-core" % Dependencies.scalafixVersion).cross(CrossVersion.for3Use2_13)

val parboiled = "org.parboiled" %% "parboiled" % "2.5.1"

Expand Down
10 changes: 9 additions & 1 deletion project/NoScala3.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,13 @@ import Keys._

object NoScala3 extends AutoPlugin {
override def projectSettings: Seq[Def.Setting[?]] = Seq(
crossScalaVersions := crossScalaVersions.value.filterNot(_.startsWith("3.")))
crossScalaVersions := crossScalaVersions.value.filterNot(_.startsWith("3.")),
Compile / unmanagedSourceDirectories := {
if (scalaVersion.value.startsWith("3.")) Seq.empty
else (Compile / unmanagedSourceDirectories).value
},
Test / unmanagedSourceDirectories := {
if (scalaVersion.value.startsWith("3.")) Seq.empty
else (Test / unmanagedSourceDirectories).value
})
}
Loading