Compile akka-serialization-jackson with Scala 3 (#30408)

Tests compile but one test fails - possibly because of the mixed Jackson
versions. Took inspiration from #30361

Refs #30243
This commit is contained in:
Arnout Engelen 2021-07-20 19:14:23 +02:00 committed by GitHub
parent ac70b1db38
commit fc1a375f51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 9 deletions

View file

@ -38,7 +38,7 @@ jobs:
- stage: scala3
name: scala3
# separate job since only a few modules compile with Scala 3 yet
script: jabba install adopt@1.11-0 && jabba use adopt@1.11-0 && sbt -Dakka.build.scalaVersion=3.0 "akka-actor-tests/test:compile" akka-actor-testkit-typed/compile akka-actor-typed/compile akka-discovery/compile akka-pki/test:compile akka-protobuf/test:compile akka-protobuf-v3/test:compile akka-slf4j/test:compile akka-stream/compile akka-stream-tests-tck/test akka-coordination/test
script: jabba install adopt@1.11-0 && jabba use adopt@1.11-0 && sbt -Dakka.build.scalaVersion=3.0 "akka-actor-tests/test:compile" akka-actor-testkit-typed/compile akka-actor-typed/compile akka-discovery/compile akka-pki/test:compile akka-protobuf/test:compile akka-protobuf-v3/test:compile akka-slf4j/test:compile akka-stream/compile akka-stream-tests-tck/test akka-coordination/test akka-serialization-jackson/test:compile
stages:
- name: whitesource

View file

@ -177,7 +177,7 @@ import akka.util.OptionVal
// TODO issue #27107: it should be possible to implement ByteBufferSerializer as well, using Jackson's
// ByteBufferBackedOutputStream/ByteBufferBackedInputStream
private val log = Logging.withMarker(system, getClass)
private val log = Logging.withMarker(system, classOf[JacksonSerializer])
private val conf = JacksonObjectMapperProvider.configForBinding(bindingName, system.settings.config)
private val isDebugEnabled = conf.getBoolean("verbose-debug-logging") && log.isDebugEnabled
private final val BufferSize = 1024 * 4

View file

@ -151,8 +151,8 @@ object ScalaTestMessages {
}
final case class WithAkkaSerializer(
@JsonDeserialize(using = classOf[AkkaSerializationDeserializer])
@JsonSerialize(using = classOf[AkkaSerializationSerializer])
@JsonDeserialize(`using` = classOf[AkkaSerializationDeserializer])
@JsonSerialize(`using` = classOf[AkkaSerializationSerializer])
akkaSerializer: HasAkkaSerializer)
extends TestMessage
}

View file

@ -16,8 +16,8 @@ object CustomAdtSerializer {
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
import com.fasterxml.jackson.databind.ser.std.StdSerializer
@JsonSerialize(using = classOf[DirectionJsonSerializer])
@JsonDeserialize(using = classOf[DirectionJsonDeserializer])
@JsonSerialize(`using` = classOf[DirectionJsonSerializer])
@JsonDeserialize(`using` = classOf[DirectionJsonDeserializer])
sealed trait Direction
object Direction {

View file

@ -163,7 +163,7 @@ object SerializationDocSpec {
final case class Lion(name: String) extends Animal
final case class Elephant(name: String, age: Int) extends Animal
@JsonDeserialize(using = classOf[UnicornDeserializer])
@JsonDeserialize(`using` = classOf[UnicornDeserializer])
sealed trait Unicorn extends Animal
@JsonTypeName("unicorn")
case object Unicorn extends Unicorn

View file

@ -293,14 +293,22 @@ object Dependencies {
jacksonCore,
jacksonAnnotations,
jacksonDatabind,
jacksonScala,
jacksonJdk8,
jacksonJsr310,
jacksonParameterNames,
jacksonCbor,
lz4Java,
Test.junit,
Test.scalatest)
Test.scalatest) ++
(if (getScalaVersion() == scala3Version)
// jackson-module-scala is only available for Scala 3 from 2.13.0 onwards.
// since we don't depend on it ourselves, but provide it as a transitive
// dependency for convenience, we can leave it out for Scala 3 for now,
// and depend on 2.13.0-rc1 for our tests. Eventually we should consider
// whether to update all jackson artifacts for Scala 3.
Seq("com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.13.0-rc1" % "test")
else
Seq(jacksonScala))
val osgi = l ++= Seq(
osgiCore,