diff --git a/native-image-tests/build.sbt b/native-image-tests/build.sbt index 58f1ff8b..39026e3e 100644 --- a/native-image-tests/build.sbt +++ b/native-image-tests/build.sbt @@ -19,7 +19,11 @@ fork := true enablePlugins(NativeImagePlugin) nativeImageJvm := "graalvm-community" nativeImageVersion := "21.0.2" -nativeImageOptions := Seq("--no-fallback", "--verbose", "-Dakka.native-image.debug=true") +nativeImageOptions := Seq( + "--no-fallback", + "--verbose", + "--initialize-at-build-time=ch.qos.logback", + "-Dakka.native-image.debug=true") libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion, diff --git a/native-image-tests/src/main/resources/META-INF/native-image/README.md b/native-image-tests/src/main/resources/META-INF/native-image/README.md deleted file mode 100644 index 6a176a67..00000000 --- a/native-image-tests/src/main/resources/META-INF/native-image/README.md +++ /dev/null @@ -1 +0,0 @@ -Custom config here is for logging using logback, loading keystore from classpath for TLS tests diff --git a/native-image-tests/src/main/resources/META-INF/native-image/ch.qos.logback/logback-classic/reflect-config.json b/native-image-tests/src/main/resources/META-INF/native-image/ch.qos.logback/logback-classic/reflect-config.json deleted file mode 100644 index 1b630ce7..00000000 --- a/native-image-tests/src/main/resources/META-INF/native-image/ch.qos.logback/logback-classic/reflect-config.json +++ /dev/null @@ -1,65 +0,0 @@ -[ - { - "name":"ch.qos.logback.classic.encoder.PatternLayoutEncoder", - "queryAllPublicMethods":true, - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.classic.pattern.DateConverter", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.classic.pattern.LevelConverter", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.classic.pattern.LineSeparatorConverter", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.classic.pattern.LoggerConverter", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.classic.pattern.MDCConverter", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.classic.pattern.MarkerConverter", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.classic.pattern.MessageConverter", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.classic.pattern.ThreadConverter", - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.core.ConsoleAppender", - "queryAllPublicMethods":true, - "methods":[{"name":"","parameterTypes":[] }] - }, - { - "name":"ch.qos.logback.core.OutputStreamAppender", - "methods":[{"name":"setEncoder","parameterTypes":["ch.qos.logback.core.encoder.Encoder"] }] - }, - { - "name":"ch.qos.logback.core.encoder.Encoder", - "methods":[{"name":"valueOf","parameterTypes":["java.lang.String"] }] - }, - { - "name":"ch.qos.logback.core.encoder.LayoutWrappingEncoder", - "methods":[{"name":"setParent","parameterTypes":["ch.qos.logback.core.spi.ContextAware"] }] - }, - { - "name":"ch.qos.logback.core.pattern.PatternLayoutEncoderBase", - "methods":[{"name":"setPattern","parameterTypes":["java.lang.String"] }] - }, - { - "name":"ch.qos.logback.core.spi.ContextAware", - "methods":[{"name":"valueOf","parameterTypes":["java.lang.String"] }] - } - -] diff --git a/native-image-tests/src/main/resources/META-INF/native-image/com.lightbend/native-image-tests/native-image.properties b/native-image-tests/src/main/resources/META-INF/native-image/com.lightbend/native-image-tests/native-image.properties deleted file mode 100644 index 3dea9206..00000000 --- a/native-image-tests/src/main/resources/META-INF/native-image/com.lightbend/native-image-tests/native-image.properties +++ /dev/null @@ -1 +0,0 @@ -Args = --initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback,org.slf4j.impl.StaticLoggerBinder,org.slf4j.MDC diff --git a/native-image-tests/src/main/resources/META-INF/native-image/com.lightbend/native-image-tests/resource-config.json b/native-image-tests/src/main/resources/META-INF/native-image/com.lightbend/native-image-tests/resource-config.json deleted file mode 100644 index e70119bc..00000000 --- a/native-image-tests/src/main/resources/META-INF/native-image/com.lightbend/native-image-tests/resource-config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "resources":{ - "includes":[{ - "pattern":"\\Qlogback.xml\\E" - }] - }, - "bundles":[] -} diff --git a/native-image-tests/src/main/scala/com/lightbend/DurableStateTester.scala b/native-image-tests/src/main/scala/com/lightbend/DurableStateTester.scala index 6017f71a..b295d376 100644 --- a/native-image-tests/src/main/scala/com/lightbend/DurableStateTester.scala +++ b/native-image-tests/src/main/scala/com/lightbend/DurableStateTester.scala @@ -10,7 +10,6 @@ import akka.persistence.typed.PersistenceId import akka.persistence.typed.state.scaladsl.DurableStateBehavior import akka.persistence.typed.state.scaladsl.Effect import akka.serialization.jackson.JsonSerializable -import com.fasterxml.jackson.annotation.JsonCreator import scala.concurrent.duration.DurationInt @@ -18,12 +17,11 @@ object DurableStateCounter { sealed trait Command extends JsonSerializable final case class Increase(amount: Int, replyTo: ActorRef[Increased]) extends Command - // FIXME why doesn't @JsonCreator work as usual? is it something missing from the jackson feature? - final case class GetState @JsonCreator() (replyTo: ActorRef[State]) extends Command + final case class GetState(replyTo: ActorRef[State]) extends Command - final case class Increased @JsonCreator() (newValue: Int) extends JsonSerializable + final case class Increased(newValue: Int) extends JsonSerializable - final case class State @JsonCreator() (value: Int) extends JsonSerializable + final case class State(value: Int) extends JsonSerializable def apply(id: String): Behavior[Command] = DurableStateBehavior[Command, State]( PersistenceId("DSCounter", id), diff --git a/native-image-tests/src/main/scala/com/lightbend/EsbTester.scala b/native-image-tests/src/main/scala/com/lightbend/EsbTester.scala index 59bab439..37d3acfc 100644 --- a/native-image-tests/src/main/scala/com/lightbend/EsbTester.scala +++ b/native-image-tests/src/main/scala/com/lightbend/EsbTester.scala @@ -11,7 +11,6 @@ import akka.persistence.typed.PersistenceId import akka.persistence.typed.scaladsl.Effect import akka.persistence.typed.scaladsl.EventSourcedBehavior import akka.serialization.jackson.JsonSerializable -import com.fasterxml.jackson.annotation.JsonCreator import scala.concurrent.duration.DurationInt @@ -19,14 +18,14 @@ object EventSourcedCounter { sealed trait Command extends JsonSerializable final case class Increase(amount: Int, replyTo: ActorRef[StatusReply[Increased]]) extends Command - final case class GetValue @JsonCreator() (replyTo: ActorRef[StatusReply[GetValueResponse]]) extends Command + final case class GetValue(replyTo: ActorRef[StatusReply[GetValueResponse]]) extends Command final case class GetValueResponse(value: Int) sealed trait Event extends JsonSerializable - final case class Increased @JsonCreator() (amount: Int) extends Event + final case class Increased(amount: Int) extends Event - final case class State @JsonCreator() (value: Int) extends JsonSerializable + final case class State(value: Int) extends JsonSerializable def apply(id: String): Behavior[Command] = EventSourcedBehavior[Command, Event, State]( PersistenceId("EventSourcedHelloWorld", id),