Skip to content

Commit

Permalink
chore: bump to akka-http to 10.7.0-M1, akka to 2.10.0-M1, align with …
Browse files Browse the repository at this point in the history
…changes from upstream (#1977)
  • Loading branch information
sebastian-alfers authored Sep 24, 2024
1 parent 15e5598 commit 102313a
Show file tree
Hide file tree
Showing 43 changed files with 100 additions and 98 deletions.
6 changes: 2 additions & 4 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ updates.pin = [
{ groupId = "org.eclipse.jgit", artifactId = "org.eclipse.jgit", version = "5." },

# https://github.com/akka/akka-grpc/issues/1661
{ groupId = "org.slf4j", artifactId = "slf4j-api", version = "1." }
# logback 1.3 and 1.4 would bump sfl4j to 2.0.0
# http://mailman.qos.ch/pipermail/announce/2022/000177.html
{ groupId = "ch.qos.logback", artifactId = "logback-classic", version = "1.2." }
{ groupId = "org.slf4j", artifactId = "slf4j-api", version = "2.0." }
{ groupId = "ch.qos.logback", artifactId = "logback-classic", version = "1.5." }
]
2 changes: 1 addition & 1 deletion benchmarks/src/main/scala/akka/grpc/BenchRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.openjdk.jmh.runner.options.CommandLineOptions
object BenchRunner {

def main(args: Array[String]): Unit = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

// @formatter:off
val args2 = args.toList.flatMap {
Expand Down
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ lazy val codegen = Project(id = akkaGrpcCodegenId, base = file("codegen"))
},
buildInfoKeys ++= Seq[BuildInfoKey](organization, name, version, scalaVersion, sbtVersion),
buildInfoKeys += "runtimeArtifactName" -> akkaGrpcRuntimeName,
buildInfoKeys += "akkaVersion" Dependencies.Versions.akka,
buildInfoKeys += "akkaHttpVersion" Dependencies.Versions.akkaHttp,
buildInfoKeys += "grpcVersion" Dependencies.Versions.grpc,
buildInfoKeys += "googleProtobufVersion" Dependencies.Versions.googleProtobuf,
buildInfoKeys += "akkaVersion" -> Dependencies.Versions.akka,
buildInfoKeys += "akkaHttpVersion" -> Dependencies.Versions.akkaHttp,
buildInfoKeys += "grpcVersion" -> Dependencies.Versions.grpc,
buildInfoKeys += "googleProtobufVersion" -> Dependencies.Versions.googleProtobuf,
buildInfoPackage := "akka.grpc.gen",
(Compile / assembly / artifact) := {
val art = (Compile / assembly / artifact).value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import protocbridge.Artifact
import templates.JavaCommon.txt.ApiInterface

import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.collection.immutable
import protocgen.CodeGenRequest

Expand Down
2 changes: 1 addition & 1 deletion codegen/src/main/scala/akka/grpc/gen/javadsl/Service.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import protocgen.CodeGenRequest
import scalapb.compiler.{ DescriptorImplicits, GeneratorParams }

import scala.annotation.tailrec
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.collection.immutable

final case class Service(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package akka.grpc.gen.scaladsl

import scala.annotation.nowarn
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.collection.immutable
import akka.grpc.gen.{ BuildInfo, CodeGenerator, Logger }
import com.google.protobuf.compiler.PluginProtos.{ CodeGeneratorRequest, CodeGeneratorResponse }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package akka.grpc.gen.scaladsl

import scala.collection.immutable
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import com.google.protobuf.Descriptors._
import protocgen.CodeGenRequest
import scalapb.compiler.{ DescriptorImplicits, GeneratorParams }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object AbstractGenerateMojo {
* e.g. { "flatPackage": "true", "serverPowerApis": "false" } -> ["flat_package"]
*/
def parseGeneratorSettings(generatorSettings: java.util.Map[String, String]): Seq[String] = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
generatorSettings.asScala.filter(_._2.toLowerCase() != "false").keys.toSeq.map { params =>
"[A-Z]".r.replaceAllIn(params, (s => s"_${s.group(0).toLowerCase()}"))
}
Expand Down Expand Up @@ -110,7 +110,7 @@ abstract class AbstractGenerateMojo @Inject() (buildContext: BuildContext) exten
@BeanProperty
var generatePlayServer: Boolean = _

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
@BeanProperty
var generatorSettings: java.util.Map[String, String] = _

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProtocSpec extends AnyWordSpec with Matchers {
}
}

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._

"Parsing generator settings" should {
"filter out the false values" in {
Expand Down
2 changes: 1 addition & 1 deletion native-image-tests/grpc-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version := "1.0"

scalaVersion := "2.13.14"

lazy val akkaVersion = sys.props.getOrElse("akka.version", "2.9.3")
lazy val akkaVersion = sys.props.getOrElse("akka.version", "2.10.0-M1")
lazy val akkaGrpcVersion = sys.props.getOrElse("akka.grpc.version", "2.4.0")

enablePlugins(AkkaGrpcPlugin)
Expand Down
2 changes: 1 addition & 1 deletion plugin-tester-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repositories {

def scalaVersion = org.gradle.util.VersionNumber.parse(System.getenv("TRAVIS_SCALA_VERSION") ?: "2.13")
def scalaBinaryVersion = "${scalaVersion.major}.${scalaVersion.minor}"
def akkaVersion = "2.9.3"
def akkaVersion = "2.10.0-M1"

tasks.named("processResources") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
Expand Down
2 changes: 1 addition & 1 deletion plugin-tester-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
<maven-exec-plugin.version>3.0.0</maven-exec-plugin.version>
<akka.http.cors.version>1.1.0</akka.http.cors.version>
<akka.version>2.9.3</akka.version>
<akka.version>2.10.0-M1</akka.version>
<grpc.version>1.63.2</grpc.version> <!-- checked synced by VersionSyncCheckPlugin -->
<project.encoding>UTF-8</project.encoding>
<build-helper-maven-plugin>3.3.0</build-helper-maven-plugin>
Expand Down
2 changes: 1 addition & 1 deletion plugin-tester-scala/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repositories {

def scalaVersion = org.gradle.util.VersionNumber.parse(System.getenv("TRAVIS_SCALA_VERSION") ?: "2.13")
def scalaBinaryVersion = "${scalaVersion.major}.${scalaVersion.minor}"
def akkaVersion = "2.9.3"
def akkaVersion = "2.10.0-M1"
def protoGoogleCommonVersion = "2.22.0"

tasks.named("processResources") {
Expand Down
2 changes: 1 addition & 1 deletion plugin-tester-scala/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<properties>
<maven.compiler.release>11</maven.compiler.release>
<akka.version>2.9.3</akka.version>
<akka.version>2.10.0-M1</akka.version>
<akka.http.cors.version>0.4.2</akka.http.cors.version>
<grpc.version>1.63.2</grpc.version> <!-- checked synced by VersionSyncCheckPlugin -->
<project.encoding>UTF-8</project.encoding>
Expand Down
9 changes: 5 additions & 4 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ object Dependencies {
// We don't force Akka updates because downstream projects can upgrade
// themselves. For more information see
// https://doc.akka.io//docs/akka/current/project/downstream-upgrade-strategy.html
val akka = "2.9.3"
val akkaBinary = "2.9"
val akkaHttp = "10.6.3"
val akka = "2.10.0-M1"
val akkaBinary = "2.11"
val akkaHttp = "10.7.0-M1"
val akkaHttpBinary = "10.6"

val grpc = "1.63.2" // checked synced by VersionSyncCheckPlugin
Expand Down Expand Up @@ -59,7 +59,7 @@ object Dependencies {
.exclude("io.grpc", "grpc-alts")
.exclude("io.grpc", "grpc-xds")

val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.36"
val slf4jApi = "org.slf4j" % "slf4j-api" % "2.0.16"
val mavenPluginApi = "org.apache.maven" % "maven-plugin-api" % Versions.maven // Apache v2
val mavenCore = "org.apache.maven" % "maven-core" % Versions.maven // Apache v2
val protocJar = "com.github.os72" % "protoc-jar" % "3.11.4"
Expand Down Expand Up @@ -113,6 +113,7 @@ object Dependencies {
Compile.akkaStream,
Compile.akkaHttpCore,
Compile.akkaHttp,
Compile.akkaPki,
Compile.akkaDiscovery,
Test.akkaTestkit,
Test.akkaStreamTestkit,
Expand Down
2 changes: 1 addition & 1 deletion project/VersionSyncCheckPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package akka.grpc

import java.nio.file.{ Files, Path, Paths }

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.sys.process._
import scala.util.matching.UnanchoredRegex

Expand Down
6 changes: 3 additions & 3 deletions runtime/src/main/scala/akka/grpc/GrpcChannel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package akka.grpc

import java.util.concurrent.CompletionStage

import scala.compat.java8.FutureConverters._
import scala.concurrent.Future
import scala.jdk.FutureConverters._

import akka.Done
import akka.actor.ClassicActorSystemProvider
Expand All @@ -25,14 +25,14 @@ final class GrpcChannel private (
* Java API: Initiates a shutdown in which preexisting and new calls are cancelled.
*/
def closeCS(): CompletionStage[Done] =
close().toJava
close().asJava

/**
* Java API: Returns a CompletionStage that completes successfully when channel is shut down via close(),
* or exceptionally if connection cannot be established or reestablished after maxConnectionAttempts.
*/
def closedCS(): CompletionStage[Done] =
closed().toJava
closed().asJava

/**
* Scala API: Initiates a shutdown in which preexisting and new calls are cancelled.
Expand Down
13 changes: 7 additions & 6 deletions runtime/src/main/scala/akka/grpc/GrpcClientSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ import akka.discovery.{ Discovery, ServiceDiscovery }
import akka.discovery.ServiceDiscovery.{ Resolved, ResolvedTarget }
import akka.grpc.internal.HardcodedServiceDiscovery
import akka.util.Helpers
import akka.util.JavaDurationConverters._
import com.typesafe.config.{ Config, ConfigValueFactory }
import io.grpc.CallCredentials
import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder
import io.grpc.netty.shaded.io.netty.handler.ssl.SslProvider

import javax.net.ssl.{ SSLContext, TrustManager }

import scala.collection.immutable
import scala.concurrent.duration.{ Duration, _ }
import scala.jdk.DurationConverters._

object GrpcClientSettings {

Expand Down Expand Up @@ -77,7 +78,7 @@ object GrpcClientSettings {
implicit actorSystem: ClassicActorSystemProvider): GrpcClientSettings = {
val clientConfiguration: Config =
actorSystem.classicSystem.settings.config.getConfig("akka.grpc.client").getConfig("\"*\"")
val resolveTimeout = clientConfiguration.getDuration("service-discovery.resolve-timeout").asScala
val resolveTimeout = clientConfiguration.getDuration("service-discovery.resolve-timeout").toScala
val discovery = Discovery.get(actorSystem).discovery
withConfigDefaults(serviceName, discovery, -1, resolveTimeout, clientConfiguration)
}
Expand All @@ -94,7 +95,7 @@ object GrpcClientSettings {
implicit actorSystem: ClassicActorSystemProvider): GrpcClientSettings = {
val clientConfiguration: Config =
actorSystem.classicSystem.settings.config.getConfig("akka.grpc.client").getConfig("\"*\"")
val resolveTimeout = clientConfiguration.getDuration("service-discovery.resolve-timeout").asScala
val resolveTimeout = clientConfiguration.getDuration("service-discovery.resolve-timeout").toScala
withConfigDefaults(serviceName, discovery, -1, resolveTimeout, clientConfiguration)
}

Expand All @@ -105,7 +106,7 @@ object GrpcClientSettings {
val serviceDiscoveryMechanism = clientConfiguration.getString("service-discovery.mechanism")
var serviceName = clientConfiguration.getString("service-discovery.service-name")
val port = clientConfiguration.getInt("port")
val resolveTimeout = clientConfiguration.getDuration("service-discovery.resolve-timeout").asScala
val resolveTimeout = clientConfiguration.getDuration("service-discovery.resolve-timeout").toScala
val sd = serviceDiscoveryMechanism match {
case "static" | "grpc-dns" =>
val host = clientConfiguration.getString("host")
Expand Down Expand Up @@ -174,7 +175,7 @@ object GrpcClientSettings {
private def getOptionalDuration(config: Config, path: String): Option[FiniteDuration] =
Helpers.toRootLowerCase(config.getString(path)) match {
case "off" => None
case _ => Some(config.getDuration(path).asScala)
case _ => Some(config.getDuration(path).toScala)
}

private def getPotentiallyInfiniteDuration(underlying: Config, path: String): Duration =
Expand Down Expand Up @@ -337,7 +338,7 @@ final class GrpcClientSettings private (
*/
@ApiMayChange
def withDiscoveryRefreshInterval(refreshInterval: java.time.Duration): GrpcClientSettings =
copy(discoveryRefreshInterval = Some(refreshInterval.asScala))
copy(discoveryRefreshInterval = Some(refreshInterval.toScala))

/**
* Request that the client try to connect the service immediately when the client is created
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/main/scala/akka/grpc/SSLContextUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import javax.net.ssl.{ TrustManager, TrustManagerFactory }
object SSLContextUtils {
def trustManagerFromStream(certStream: InputStream): TrustManager = {
try {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
val cf = CertificateFactory.getInstance("X.509")
val bis = new BufferedInputStream(certStream)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private[akka] final class AkkaDiscoveryNameResolver(

@throws[UnknownHostException]
private def addresses(addresses: Seq[ResolvedTarget]) = {
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
addresses
.map(target => {
val port = target.port.getOrElse(defaultPort)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import javax.net.ssl.KeyManager
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import scala.collection.immutable
import scala.compat.java8.FutureConverters.FutureOps
import scala.jdk.FutureConverters.FutureOps
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
Expand Down Expand Up @@ -305,7 +305,7 @@ object AkkaHttpClientUtils {
override def getTrailers(): CompletionStage[akka.grpc.javadsl.Metadata] =
trailerPromise.future
.map[akka.grpc.javadsl.Metadata](h => new JavaMetadataImpl(new HeaderMetadataImpl(h)))
.toJava
.asJava
}))
case Failure(e) =>
Source.failed[O](e).mapMaterializedValue(_ => Future.failed(e))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
package akka.grpc.internal

import akka.annotation.InternalApi
import akka.dispatch.ExecutionContexts
import akka.grpc.GrpcResponseMetadata
import akka.stream
import akka.stream.{ Attributes => _, _ }
import akka.stream.stage._
import io.grpc._

import scala.concurrent.ExecutionContext
import scala.concurrent.{ Future, Promise }
import scala.compat.java8.FutureConverters._
import scala.jdk.FutureConverters._

@InternalApi
private object AkkaNettyGrpcClientGraphStage {
Expand Down Expand Up @@ -92,10 +92,10 @@ private final class AkkaNettyGrpcClientGraphStage[I, O](
def getHeaders() = jMetadata

private lazy val sTrailers =
trailerPromise.future.map(MetadataImpl.scalaMetadataFromGoogleGrpcMetadata)(ExecutionContexts.parasitic)
trailerPromise.future.map(MetadataImpl.scalaMetadataFromGoogleGrpcMetadata)(ExecutionContext.parasitic)
private lazy val jTrailers = trailerPromise.future
.map(MetadataImpl.javaMetadataFromGoogleGrpcMetadata)(ExecutionContexts.parasitic)
.toJava
.map(MetadataImpl.javaMetadataFromGoogleGrpcMetadata)(ExecutionContext.parasitic)
.asJava
def trailers = sTrailers
def getTrailers() = jTrailers
})
Expand Down
10 changes: 5 additions & 5 deletions runtime/src/main/scala/akka/grpc/internal/MetadataImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
package akka.grpc.internal

import java.util.{ Locale, Optional, List => jList, Map => jMap }
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.collection.immutable
import scala.compat.java8.OptionConverters._
import scala.jdk.OptionConverters._
import akka.annotation.InternalApi
import akka.http.scaladsl.model.{ AttributeKey, HttpHeader, HttpMessage }
import akka.http.javadsl.{ model => jm }
Expand Down Expand Up @@ -224,10 +224,10 @@ class HttpMessageMetadataImpl(message: HttpMessage) extends HeaderMetadataImpl(m
@InternalApi
class JavaMetadataImpl(val delegate: Metadata) extends javadsl.Metadata with javadsl.MetadataStatus {
override def getText(key: String): Optional[String] =
delegate.getText(key).asJava
delegate.getText(key).toJava

override def getBinary(key: String): Optional[ByteString] =
delegate.getBinary(key).asJava
delegate.getBinary(key).toJava

override def asMap(): jMap[String, jList[javadsl.MetadataEntry]] = {
// This method is also affected by incompatible changes between scala 2.12 and 2.13. (See comment in
Expand All @@ -244,7 +244,7 @@ class JavaMetadataImpl(val delegate: Metadata) extends javadsl.Metadata with jav
delegate

override def getAttribute[T](key: jm.AttributeKey[T]): Optional[T] =
delegate.rawHttpMessage.flatMap(_.attribute(key)).asJava
delegate.rawHttpMessage.flatMap(_.attribute(key)).toJava

override def toString: String =
delegate.toString
Expand Down
Loading

0 comments on commit 102313a

Please sign in to comment.