Skip to content

Commit e27d93d

Browse files
authored
Merge branch 'main' into wip-periodic-client-discovery-refresh
2 parents e25eb0b + 8600fd8 commit e27d93d

File tree

19 files changed

+117
-46
lines changed

19 files changed

+117
-46
lines changed

.github/workflows/build-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ jobs:
217217
- name: Test Maven Java
218218
run: |-
219219
cd plugin-tester-java
220-
mvn -Dakka.grpc.project.version=`cat ~/.version` compile
220+
mvn -nsu -ntp -Dakka.grpc.project.version=`cat ~/.version` compile
221221
222222
- name: Test Maven Scala
223223
run: |-
224224
cd plugin-tester-scala
225-
mvn -Dakka.grpc.project.version=`cat ~/.version` akka-grpc:generate scala:compile
225+
mvn -nsu -ntp -Dakka.grpc.project.version=`cat ~/.version` akka-grpc:generate scala:compile
226226
227227
test-docs:
228228
name: Docs
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Native Image Tests
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
native-image-tests:
13+
name: Run Native Image Tests
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- name: Checkout
17+
uses: actions/[email protected]
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Checkout GitHub merge
22+
if: github.event.pull_request
23+
run: |-
24+
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
25+
git checkout scratch
26+
27+
- name: Cache Coursier cache
28+
# https://github.com/coursier/cache-action/releases
29+
uses: coursier/[email protected]
30+
31+
- name: Set up JDK 11
32+
# https://github.com/coursier/setup-action/releases
33+
uses: coursier/[email protected]
34+
with:
35+
jvm: temurin:1.11
36+
37+
- name: Gather version
38+
run: |-
39+
echo `git describe --tags | sed -e "s/v\(.*\)-\([0-9][0-9]*\).*/\\1+\\2-/"``git rev-parse HEAD | head -c8`-SNAPSHOT > ~/.version
40+
cat ~/.version
41+
42+
- name: Publish artifacts locally
43+
run: |-
44+
sbt "publishLocal; publishM2"
45+
46+
- name: Email on failure
47+
if: ${{ failure() }}
48+
uses: dawidd6/action-send-mail@6063705cefe50cb915fc53bb06d4049cae2953b2
49+
with:
50+
server_address: smtp.gmail.com
51+
server_port: 465
52+
secure: true
53+
username: ${{secrets.MAIL_USERNAME}}
54+
password: ${{secrets.MAIL_PASSWORD}}
55+
subject: "Failed: ${{ github.workflow }} / ${{ github.job }}"
56+
to: ${{secrets.MAIL_SEND_TO}}
57+
from: Akka CI
58+
body: |
59+
Job ${{ github.job }} in workflow ${{ github.workflow }} of ${{github.repository}} failed!
60+
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

.github/workflows/nightly.yml

-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ jobs:
3737
uses: coursier/[email protected]
3838
with:
3939
jvm: ${{ matrix.jvmName }}
40-
# FIXME default index not giving us access to JDK 21 (yet)
41-
jvm-index: https://raw.githubusercontent.com/coursier/jvm-index/32d659500e6c65efb9eee91718a0fb0e797ad4ee/index.json
4240

4341
- name: sbt test
4442
run: |-

.github/workflows/publish.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ jobs:
3939
gradle-plugin:
4040
name: Release gradle plugin
4141
runs-on: ubuntu-22.04
42-
if: github.repository == 'akka/akka-grpc'
42+
# only on tagged release, not snapshot
43+
if: github.repository == 'akka/akka-grpc' && startsWith(github.ref, 'refs/tags/')
4344
steps:
4445
- name: Checkout
4546
uses: actions/[email protected]

benchmark-java/build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ run / javaOptions ++= List("-Xms1g", "-Xmx1g", "-XX:+PrintGCDetails", "-XX:+Prin
99
// generate both client and server (default) in Java
1010
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Java)
1111

12-
val grpcVersion = "1.58.0" // checked synced by VersionSyncCheckPlugin
12+
val grpcVersion = "1.60.0" // checked synced by VersionSyncCheckPlugin
1313

1414
val runtimeProject = ProjectRef(file("../"), "akka-grpc-runtime")
1515

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.7
1+
sbt.version=1.9.8

gradle-plugin/src/main/groovy/akka/grpc/gradle/AkkaGrpcPluginExtension.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class AkkaGrpcPluginExtension {
99

1010
static final String PROTOC_PLUGIN_SCALA_VERSION = "2.12"
1111

12-
static final String GRPC_VERSION = "1.58.0" // checked synced by VersionSyncCheckPlugin
12+
static final String GRPC_VERSION = "1.60.0" // checked synced by VersionSyncCheckPlugin
1313

1414
static final String PLUGIN_CODE = 'com.lightbend.akka.grpc.gradle'
1515

plugin-tester-java/pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
1616
<maven-exec-plugin.version>3.0.0</maven-exec-plugin.version>
1717
<akka.http.cors.version>1.1.0</akka.http.cors.version>
18+
1819
<akka.version>2.9.1</akka.version>
19-
<grpc.version>1.58.0</grpc.version> <!-- checked synced by VersionSyncCheckPlugin -->
20+
<grpc.version>1.60.0</grpc.version> <!-- checked synced by VersionSyncCheckPlugin -->
2021
<project.encoding>UTF-8</project.encoding>
2122
<build-helper-maven-plugin>3.3.0</build-helper-maven-plugin>
2223
<protobuf-java.version>3.22.2</protobuf-java.version>

plugin-tester-scala/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<maven.compiler.release>11</maven.compiler.release>
1515
<akka.version>2.9.1</akka.version>
1616
<akka.http.cors.version>0.4.2</akka.http.cors.version>
17-
<grpc.version>1.58.0</grpc.version> <!-- checked synced by VersionSyncCheckPlugin -->
17+
<grpc.version>1.60.0</grpc.version> <!-- checked synced by VersionSyncCheckPlugin -->
1818
<project.encoding>UTF-8</project.encoding>
1919
</properties>
2020

project/Common.scala

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import akka.grpc.Dependencies.Versions.{ scala212, scala213, scala3 }
77
import com.lightbend.paradox.projectinfo.ParadoxProjectInfoPluginKeys.projectInfoVersion
88
import org.scalafmt.sbt.ScalafmtPlugin.autoImport.scalafmtOnCompile
99
import com.typesafe.tools.mima.plugin.MimaKeys._
10-
import sbtprotoc.ProtocPlugin.autoImport.PB
1110
import xerial.sbt.Sonatype
1211

1312
object Common extends AutoPlugin {

project/Dependencies.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ object Dependencies {
2222
val akkaHttp = "10.6.0"
2323
val akkaHttpBinary = "10.6"
2424

25-
val grpc = "1.58.0" // checked synced by VersionSyncCheckPlugin
25+
val grpc = "1.60.0" // checked synced by VersionSyncCheckPlugin
2626

2727
// Even referenced explicitly in the sbt-plugin's sbt-tests
2828
// If changing this, remember to update protoc plugin version to align in
2929
// maven-plugin/src/main/maven/plugin.xml and akka.grpc.sbt.AkkaGrpcPlugin
3030
val googleProtobuf = "3.24.0" // checked synced by VersionSyncCheckPlugin
31-
val googleApi = "2.23.0"
31+
val googleApi = "2.30.0"
3232

3333
val scalaTest = "3.2.12"
3434

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.7
1+
sbt.version=1.9.8

project/plugins.sbt

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ addSbtPlugin("lt.dvim.authors" % "sbt-authors" % "1.3")
88
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
99
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
1010
addSbtPlugin("com.thesamet" % "sbt-protoc" % sbtProtocV)
11-
addSbtPlugin("com.typesafe.play" % "sbt-twirl" % "1.6.2")
11+
addSbtPlugin("org.playframework.twirl" % "sbt-twirl" % "2.0.3")
1212
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.5")
1313
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
1414
addSbtPlugin("io.spray" % "sbt-revolver" % "0.10.0")
1515
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
1616
addSbtPlugin("net.bzzt" % "sbt-reproducible-builds" % "0.31")
17-
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6")
17+
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7")
1818
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
1919

2020
// docs
21-
addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.53")
21+
addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.54")
2222
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-dependencies" % "0.2.4")
23-
addSbtPlugin("com.lightbend.sbt" % "sbt-publish-rsync" % "0.2")
23+
addSbtPlugin("com.lightbend.sbt" % "sbt-publish-rsync" % "0.3")
2424
addSbtPlugin("com.github.sbt" % "sbt-site-paradox" % "1.5.0")
2525

2626
// For RawText
27-
libraryDependencies += "org.eclipse.jgit" % "org.eclipse.jgit" % "5.13.2.202306221912-r"
27+
libraryDependencies += "org.eclipse.jgit" % "org.eclipse.jgit" % "5.13.3.202401111512-r"
2828

2929
// scripted testing
3030
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# internal API
2+
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.grpc.internal.AkkaDiscoveryNameResolverProvider.this")

runtime/src/main/scala/akka/grpc/internal/AkkaDiscoveryNameResolverProvider.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import scala.concurrent.duration.FiniteDuration
2121
private[akka] final class AkkaDiscoveryNameResolverProvider(
2222
discovery: ServiceDiscovery,
2323
defaultPort: Int,
24+
serviceName: String,
2425
portName: Option[String],
2526
protocol: Option[String],
2627
resolveTimeout: FiniteDuration,
@@ -33,7 +34,6 @@ private[akka] final class AkkaDiscoveryNameResolverProvider(
3334
override def getDefaultScheme: String = "http"
3435

3536
override def newNameResolver(targetUri: URI, args: NameResolver.Args): AkkaDiscoveryNameResolver = {
36-
require(targetUri.getAuthority != null, s"target uri should not have null authority, got [$targetUri]")
3737
new AkkaDiscoveryNameResolver(
3838
discovery,
3939
defaultPort,

runtime/src/main/scala/akka/grpc/internal/Codecs.scala

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ object Codecs {
2525
* @return a codec to compress data frame bodies with, which will be [[Identity]] unless the client specifies support for another supported encoding.
2626
*/
2727
def negotiate(request: jm.HttpRequest): Codec = {
28-
val accepted: Array[String] =
29-
request.asInstanceOf[sm.HttpMessage].header[`Message-Accept-Encoding`] match {
30-
case Some(h) => h.values
31-
case None => Array.empty
32-
}
28+
// DO NOT USE request.header[`Message-Accept-Encoding`], as that doesn't work for custom headers
29+
val accepted = `Message-Accept-Encoding`.findIn(request.asInstanceOf[sm.HttpMessage].headers)
3330

3431
if (accepted.length == 0) {
3532
Identity

runtime/src/main/scala/akka/grpc/internal/NettyClientUtils.scala

+32-20
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,36 @@ import javax.net.ssl.SSLContext
1111
import akka.{ Done, NotUsed }
1212
import akka.annotation.InternalApi
1313
import akka.event.LoggingAdapter
14-
import akka.grpc.{ GrpcClientSettings, GrpcResponseMetadata, GrpcSingleResponse }
15-
import akka.stream.scaladsl.{ Flow, Keep, Source }
16-
import io.grpc.{ CallOptions, MethodDescriptor }
14+
import akka.grpc.GrpcClientSettings
15+
import akka.grpc.GrpcResponseMetadata
16+
import akka.grpc.GrpcSingleResponse
17+
import akka.stream.scaladsl.Flow
18+
import akka.stream.scaladsl.Keep
19+
import akka.stream.scaladsl.Source
20+
import akka.Done
21+
import akka.NotUsed
1722
import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts
1823
import io.grpc.netty.shaded.io.grpc.netty.NegotiationType
1924
import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder
20-
import io.grpc.netty.shaded.io.netty.handler.ssl.ApplicationProtocolConfig.{
21-
Protocol,
22-
SelectedListenerFailureBehavior,
23-
SelectorFailureBehavior
24-
}
25-
import io.grpc.netty.shaded.io.netty.handler.ssl.{
26-
ApplicationProtocolConfig,
27-
ApplicationProtocolNames,
28-
SslContext,
29-
SslContextBuilder
30-
}
25+
import io.grpc.netty.shaded.io.netty.handler.ssl.ApplicationProtocolConfig.Protocol
26+
import io.grpc.netty.shaded.io.netty.handler.ssl.ApplicationProtocolConfig.SelectedListenerFailureBehavior
27+
import io.grpc.netty.shaded.io.netty.handler.ssl.ApplicationProtocolConfig.SelectorFailureBehavior
28+
import io.grpc.netty.shaded.io.netty.handler.ssl.ApplicationProtocolConfig
29+
import io.grpc.netty.shaded.io.netty.handler.ssl.ApplicationProtocolNames
30+
import io.grpc.netty.shaded.io.netty.handler.ssl.SslContext
31+
import io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder
32+
import io.grpc.CallOptions
33+
import io.grpc.MethodDescriptor
3134

35+
import java.util.concurrent.TimeUnit
36+
import javax.net.ssl.SSLContext
3237
import scala.annotation.nowarn
3338
import scala.concurrent.duration.FiniteDuration
34-
import scala.concurrent.{ ExecutionContext, Future, Promise }
35-
import scala.util.{ Failure, Success }
39+
import scala.concurrent.ExecutionContext
40+
import scala.concurrent.Future
41+
import scala.concurrent.Promise
42+
import scala.util.Failure
43+
import scala.util.Success
3644

3745
/**
3846
* INTERNAL API
@@ -51,15 +59,17 @@ object NettyClientUtils {
5159
@nowarn("msg=deprecated")
5260
var builder =
5361
NettyChannelBuilder
54-
// Not sure why netty wants to be able to shoe-horn the target into a URI... but ok,
55-
// we follow their lead and encode the service name as the 'authority' of the URI.
56-
.forTarget("//" + settings.serviceName)
62+
// Used to be the way to pass the service name to the name resolver but
63+
// Since grpc-core 1.60.0 Netty does no longer seem to pass the authority along, so we do that
64+
// ourselves below (channel builder is not shared between different clients anyway).
65+
.forTarget(s"//${settings.serviceName}")
5766
.flowControlWindow(NettyChannelBuilder.DEFAULT_FLOW_CONTROL_WINDOW)
5867
// TODO avoid nameResolverFactory #1092, then 'nowarn' can be removed above
5968
.nameResolverFactory(
6069
new AkkaDiscoveryNameResolverProvider(
6170
settings.serviceDiscovery,
6271
settings.defaultPort,
72+
settings.serviceName,
6373
settings.servicePortName,
6474
settings.serviceProtocol,
6575
settings.resolveTimeout,
@@ -181,7 +191,9 @@ object NettyClientUtils {
181191
*/
182192
@InternalApi
183193
private def createNettySslContext(javaSslContext: SSLContext): SslContext = {
184-
import io.grpc.netty.shaded.io.netty.handler.ssl.{ ClientAuth, IdentityCipherSuiteFilter, JdkSslContext }
194+
import io.grpc.netty.shaded.io.netty.handler.ssl.ClientAuth
195+
import io.grpc.netty.shaded.io.netty.handler.ssl.IdentityCipherSuiteFilter
196+
import io.grpc.netty.shaded.io.netty.handler.ssl.JdkSslContext
185197
// See
186198
// https://github.com/netty/netty/blob/4.1/handler/src/main/java/io/netty/handler/ssl/JdkSslContext.java#L229-L309
187199
val apn = new ApplicationProtocolConfig(

runtime/src/test/scala/akka/grpc/internal/AkkaDiscoveryNameResolverProviderSpec.scala

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class AkkaDiscoveryNameResolverProviderSpec
5151
val provider = new AkkaDiscoveryNameResolverProvider(
5252
discovery,
5353
443,
54+
serviceName = serviceName,
5455
portName = None,
5556
protocol = None,
5657
resolveTimeout = 3.seconds,

sbt-plugin/src/sbt-test/gen-scala-server/00-interop/build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resolvers += "Akka library repository".at("https://repo.akka.io/maven")
44

55
organization := "com.lightbend.akka.grpc"
66

7-
val grpcVersion = "1.58.0" // checked synced by VersionSyncCheckPlugin
7+
val grpcVersion = "1.60.0" // checked synced by VersionSyncCheckPlugin
88

99
libraryDependencies ++= Seq(
1010
"io.grpc" % "grpc-interop-testing" % grpcVersion % "protobuf-src",

0 commit comments

Comments
 (0)