when updating Kotlin to 2.2.0, I'm getting <this> ...
# gradle
p
when updating Kotlin to 2.2.0, I'm getting this when building `buildSrc`:
Copy code
e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.2.0/4258f471b10f4fce1b1c000b59495b7413e1af9a/kotlin-reflect-2.2.0.jar!/META-INF/descriptors.jvm.kotlin_module Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.2.0, expected version is 2.0.0.
Do I think correctly that we need to wait for Gradle supporting metadata of at least 2.1.0?
t
either you need to use "org.jetbrains.kotlin.jvm" plugin version
2.2.0
in
buildSrc
or wait for Gradle 9.0
p
but then I'm getting
Copy code
WARNING: Unsupported Kotlin plugin version.
The `embedded-kotlin` and `kotlin-dsl` plugins rely on features of Kotlin `2.0.21` that might work differently than in the requested version `2.2.0`.
Does it mean that as long as I don't use any features that changed their behavior across these versions, things will work fine?
👍 1
👌 2
v
What you have there in
buildSrc
is as follows: 1. You use
kotlin("jvm") version embeddedKotlinVersion
2.
dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom:2.2.0"))
It means the compiler is the one embedded in Gradle while you supply it with a much newer libraries. That is not guaranteed to work as Kotlin does not guarantee forward compatibility. I’m afraid there are no good solutions there. a) You could stick with kotlin-serialization that is compatible with the minimal Gradle version you want to support. Then your plugin will b) You could shade kotlin-* libraries so your Gradle plugin uses its own variation of kotlin-* which does not interfere with the ones Gradle provides. Frankly shading does not sound great. Having a limit on kotlin-serialization version might be ok.
👍 1
https://kotlinlang.org/docs/kotlin-evolution-principles.html
Forward compatibility is not guaranteed. For example, the 2.0.x compiler is not guaranteed to read binaries produced by the 2.1.x compiler
Preferably (but we can’t guarantee it), the binary format is mostly forwards compatible with the next language release
p
thanks! I actually moved to
kotlin("jvm") version "2.2.0"
(ref), I guess it's good enough for now