detekt / sarif4k

Kotlin data bindings for the Static Analysis Results Interchange Format (SARIF)
Apache License 2.0
15 stars 7 forks source link

Does not work (out of the box) in a minified app #108

Open TWiStErRob opened 3 months ago

TWiStErRob commented 3 months ago
Exception in thread "main" kotlinx.serialization.SerializationException: Serializer for class 'SarifSchema210' is not found.
Mark the class as @Serializable or provide the serializer explicitly.
        at kotlinx.serialization.internal.Platform_commonKt.serializerNotRegistered(Platform.common.kt:91)
        at kotlinx.serialization.internal.PlatformKt.platformSpecificSerializerNotRegistered(Platform.kt:29)
        at kotlinx.serialization.SerializersKt__SerializersKt.serializer(Serializers.kt:60)
        at kotlinx.serialization.SerializersKt.serializer(Unknown Source)
        at io.github.detekt.sarif4k.SarifSerializer.toJson(SarifSerializer.kt:23)

The proguard/r8 rules actually exist in https://github.com/Kotlin/kotlinx.serialization/blob/master/rules/common.pro, but only since 1.5.

43 would solve this immediately, workaround:

implementation("io.github.detekt.sarif4k:sarif4k:0.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
BraisGabin commented 3 months ago

We could update it to the latest version, or 1.5.0 at least. We are at 0. version so this shouldn't be a huge problem.