:wave: anyone using `kotlin-compile-testing` (<Zac...
# serialization
d
👋 anyone using
kotlin-compile-testing
(Zac's fork with support for Kotlin 1.8) with
kotlinx-serialization
? Trying to compile my auto-generated sources but getting compilation error complaining about
Unresolved reference: serializer
(from calls on
@Serializable
classes ->
MySerializableClass.serializer()
). It kind of looks like the
SerializationComponentRegistrar
is not applied
Copy code
val compilationResult = KotlinCompilation().apply {
  jvmTarget = "1.8"
  sources = generatedSources
  inheritClassPath = true
  compilerPluginRegistrars = listOf(SerializationComponentRegistrar())
}.compile()
libs
Copy code
kotlin = "1.8.0"
kotlinx-coroutines = "1.7.3"
kotlinx-serialization = "1.5.1"

compile-testing = "0.2.1"
that was a bug in the library (fixed in v0.3.0)
👋 trying to update to Kotlin 1.9 but looks like my project can no longer find
org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
(used in my unit tests through
kotlin-compile-testing
) - is there something missing? anyone else encountered this problem?
interesting so the issue appears to be with the actual distributions • old (working) -> https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-serialization/1.8.0/kotlin-serialization-1.8.0-gradle76.jar • new (not working) -> https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-serialization/1.9.0/kotlin-serialization-1.9.0-gradle76.jar (or https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-serialization/1.9.0/kotlin-serialization-1.9.0-gradle81.jar) the difference is that NEW (v1.9) versions no longer contain the referenced
org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationComponentRegistrar
class *another odd issue is that sources JARs actually DO NOT contain all source files and include only a subset of files
d
Yeah
z
Looks like it’s… there? 😅
d
Compare contents of jars (linked above)
tried adding the
kotlin-serialization-unshaded
and
kotlin-serialization-compiler-plugin
dependencies (which contain the serialization registrar) directly but those fail with
NoSuchMethodError
implying there are some classpath issues there but nothing obvious pops out (as in all deps show kotlin 1.9) -> https://scans.gradle.com/s/6hmz6vv6eab7s/dependencies?toggled=W1syXSxbMiwxM11d If anyone has any ideas I'm all ears. Any help would be greatly appreciated
🧵 1