Kotlin / kotlinx.serialization

Kotlin multiplatform / multi-format serialization
Apache License 2.0
5.38k stars 620 forks source link

Introduce version compatibility checker into the plugin #1810

Open altavir opened 2 years ago

altavir commented 2 years ago

What is your use-case and why do you need this feature?

The major part of errors and strange behaviors in serialization comes from inconsistencies between versions of the plugin and actually used versions of the library or even variations of library versions between flavors (core and Json for example). It usually could be solved by carefully studying the classpath, but the problem is that the errors produced by those inconsistencies are very hard to understand.

Describe the solution you'd like

Introduce a version checking task in the kotlin Gradle plugin, which will validate the compiler version against all used library versions (not necessary only serialization) and throw an error during the build phase if something incompatible is found. The compatibility table could be stored externally so one could update it without updating the plugin. If the table is not available, the version check could be bypassed or a default hard-coded table is used.

sandwwraith commented 2 years ago

We already have this check for JVM, see points 2 and 3 here: https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/compatibility.md#compatibility-with-kotlin-compiler-plugin

You're complaining about other targets, right?