From 3b644efe6e0910cc68cf1fed168ef41a2c33bbe6 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 24 Oct 2024 14:50:36 +0200 Subject: [PATCH] bump: Akka 2.9.7, grpc 1.4.4 (#2227) --- project/Dependencies.scala | 6 ++-- project/plugins.sbt | 2 +- .../compile-only/project/plugins.sbt | 2 +- .../eventsourcedentity/project/plugins.sbt | 2 +- .../no-common-pkg-root/project/plugins.sbt | 2 +- .../KalixRunnerLicenseKeySupplier.java | 36 +++++++++++++++++++ .../scala/kalix/javasdk/KalixRunner.scala | 20 ++++++++--- 7 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 sdk/java-sdk-protobuf/src/main/java/kalix/javasdk/KalixRunnerLicenseKeySupplier.java diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 451006e950..ff139bd5fb 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -19,10 +19,9 @@ object Dependencies { val Scala3Version = "3.3.3" val CrossScalaVersions = Seq(ScalaVersion, Scala3Version) - val ProtobufVersion = // akka.grpc.gen.BuildInfo.googleProtobufVersion - "3.21.12" // explicitly overriding the 3.21.1 version from Akka gRPC 2.1.6 (even though its build says 3.20.1) + val ProtobufVersion = akka.grpc.gen.BuildInfo.googleProtobufVersion - val AkkaVersion = "2.9.3" + val AkkaVersion = "2.9.7" val AkkaHttpVersion = "10.6.3" // Note: should at least the Akka HTTP version required by Akka gRPC val ScalaTestVersion = "3.2.14" // https://github.com/akka/akka/blob/main/project/Dependencies.scala#L31 @@ -97,6 +96,7 @@ object Dependencies { akkaDependency("akka-stream"), akkaDependency("akka-slf4j"), akkaDependency("akka-discovery"), + akkaDependency("akka-pki"), akkaHttpDependency("akka-http"), akkaHttpDependency("akka-http-core"), akkaHttpDependency("akka-http-spray-json"), diff --git a/project/plugins.sbt b/project/plugins.sbt index 0891986113..be0cc0684f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,7 +3,7 @@ resolvers += "Akka library repository".at("https://repo.akka.io/maven") addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16") addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1") // even updated `akka-grpc.version` in pom.xml files -addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.4.3") +addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.4.4") addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.7.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0") diff --git a/sbt-plugin/src/sbt-test/sbt-kalix/compile-only/project/plugins.sbt b/sbt-plugin/src/sbt-test/sbt-kalix/compile-only/project/plugins.sbt index 06a0c0b6d7..899d8c0c60 100644 --- a/sbt-plugin/src/sbt-test/sbt-kalix/compile-only/project/plugins.sbt +++ b/sbt-plugin/src/sbt-test/sbt-kalix/compile-only/project/plugins.sbt @@ -4,4 +4,4 @@ sys.props.get("plugin.version") match { case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } -addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.1.4") // FIXME should be included via sbt-kalix +addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.4.4") // FIXME should be included via sbt-kalix diff --git a/sbt-plugin/src/sbt-test/sbt-kalix/eventsourcedentity/project/plugins.sbt b/sbt-plugin/src/sbt-test/sbt-kalix/eventsourcedentity/project/plugins.sbt index 06a0c0b6d7..899d8c0c60 100644 --- a/sbt-plugin/src/sbt-test/sbt-kalix/eventsourcedentity/project/plugins.sbt +++ b/sbt-plugin/src/sbt-test/sbt-kalix/eventsourcedentity/project/plugins.sbt @@ -4,4 +4,4 @@ sys.props.get("plugin.version") match { case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } -addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.1.4") // FIXME should be included via sbt-kalix +addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.4.4") // FIXME should be included via sbt-kalix diff --git a/sbt-plugin/src/sbt-test/sbt-kalix/no-common-pkg-root/project/plugins.sbt b/sbt-plugin/src/sbt-test/sbt-kalix/no-common-pkg-root/project/plugins.sbt index 06a0c0b6d7..899d8c0c60 100644 --- a/sbt-plugin/src/sbt-test/sbt-kalix/no-common-pkg-root/project/plugins.sbt +++ b/sbt-plugin/src/sbt-test/sbt-kalix/no-common-pkg-root/project/plugins.sbt @@ -4,4 +4,4 @@ sys.props.get("plugin.version") match { case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } -addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.1.4") // FIXME should be included via sbt-kalix +addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "2.4.4") // FIXME should be included via sbt-kalix diff --git a/sdk/java-sdk-protobuf/src/main/java/kalix/javasdk/KalixRunnerLicenseKeySupplier.java b/sdk/java-sdk-protobuf/src/main/java/kalix/javasdk/KalixRunnerLicenseKeySupplier.java new file mode 100644 index 0000000000..1abec5356a --- /dev/null +++ b/sdk/java-sdk-protobuf/src/main/java/kalix/javasdk/KalixRunnerLicenseKeySupplier.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2021-2024 Lightbend Inc. + */ + +package kalix.javasdk; + +import akka.actor.dungeon.LicenseKeySupplier; +import com.typesafe.config.Config; + +import java.util.function.Supplier; + +/** + * INTERNAL API: Written in Java to be package private + */ +class KalixRunnerLicenseKeySupplier implements LicenseKeySupplier { + + @Override + public void implementing_this_is_a_violation_of_the_akka_license() { + } + + @Override + public String get(Config config) { + return "3CecWl2eB9O9eHXVjfZjhSA55GSJTudOl8i8gTiPFDLe8MmzU0iPH8V8Ma8kQNmhpu8hzdTesrFa0931MAKNJevZAJimVbQrzDo9CWJ2wgRHAQA55EZrp0OFH8hurn17aPStA57p49suFWd48w8jIeWhzJ47FZPc9wheI9HBORPDdFch8XvogD3tTEJEeaPupCcmizJ27qz0AGSMtD73BuqmRF8sIHWvNAhoMGN4vTabIGi4r"; + } + + A aroundActorSystemCreation(Supplier creator) { + LicenseKeySupplier.instance().set(this); + try { + return creator.get(); + } finally { + LicenseKeySupplier.instance().set(null); // clear ThreadLocal + } + } + + +} diff --git a/sdk/java-sdk-protobuf/src/main/scala/kalix/javasdk/KalixRunner.scala b/sdk/java-sdk-protobuf/src/main/scala/kalix/javasdk/KalixRunner.scala index d7d51bad20..1ff8222cb6 100644 --- a/sdk/java-sdk-protobuf/src/main/scala/kalix/javasdk/KalixRunner.scala +++ b/sdk/java-sdk-protobuf/src/main/scala/kalix/javasdk/KalixRunner.scala @@ -115,7 +115,12 @@ final class KalixRunner private[javasdk] ( * Creates a KalixRunner from the given services. Use the default config to create the internal ActorSystem. */ def this(services: java.util.Map[String, java.util.function.Function[ActorSystem, Service]], sdkName: String) = { - this(ActorSystem("kalix", KalixRunner.loadPreparedConfig()), services.asScala.toMap, aclDescriptor = None, sdkName) + this( + (new KalixRunnerLicenseKeySupplier).aroundActorSystemCreation(() => + ActorSystem("kalix", KalixRunner.loadPreparedConfig())), + services.asScala.toMap, + aclDescriptor = None, + sdkName) } def this( @@ -123,7 +128,8 @@ final class KalixRunner private[javasdk] ( aclDescriptor: Option[FileDescriptorProto], sdkName: String) = this( - ActorSystem("kalix", KalixRunner.loadPreparedConfig()), + (new KalixRunnerLicenseKeySupplier).aroundActorSystemCreation(() => + ActorSystem("kalix", KalixRunner.loadPreparedConfig())), services.asScala.toMap, aclDescriptor = aclDescriptor, sdkName) @@ -137,7 +143,12 @@ final class KalixRunner private[javasdk] ( services: java.util.Map[String, java.util.function.Function[ActorSystem, Service]], config: Config, sdkName: String) = - this(ActorSystem("kalix", KalixRunner.prepareConfig(config)), services.asScala.toMap, aclDescriptor = None, sdkName) + this( + (new KalixRunnerLicenseKeySupplier).aroundActorSystemCreation(() => + ActorSystem("kalix", KalixRunner.prepareConfig(config))), + services.asScala.toMap, + aclDescriptor = None, + sdkName) def this( services: java.util.Map[String, java.util.function.Function[ActorSystem, Service]], @@ -145,7 +156,8 @@ final class KalixRunner private[javasdk] ( aclDescriptor: Option[FileDescriptorProto], sdkName: String) = this( - ActorSystem("kalix", KalixRunner.prepareConfig(config)), + (new KalixRunnerLicenseKeySupplier).aroundActorSystemCreation(() => + ActorSystem("kalix", KalixRunner.prepareConfig(config))), services.asScala.toMap, aclDescriptor = aclDescriptor, sdkName)