What's Kotlin strategy for dropping support for ol...
# library-development
m
What's Kotlin strategy for dropping support for older
languageVersion
? Looks like 2.3 drops support for
languageVersion < 1.9
? It's a ~2.5 years window which means I can't use KGP 2.3 and target Gradle 8, which is still widely in use. I'm not asking that we have a 12 years java8-like update window but a couple more years would be useful. Or is this made on purpose to drive the ecosystem forward?
o
You can use KGP 2.3 but switch compiler version via BTA: https://kotlinlang.org/docs/build-tools-api.html
👀 1
m
"the three last major versions" so that's ~2 years indeed
o
And as stated in https://kotlinlang.org/docs/kotlin-evolution-principles.html#compatibility-options compiler supports 3 previous versions
👍 1
m
Any chance to have that bumped a little bit?
o
In Dokka, for example, we still support Gradle 7, by using 2.0.21 compiler and KGP 2.3 :)
👍 1
And language version 1.something (don't remember)
m
Yea I can try that.
KGP is the main thing I need really up to date
kotlinc would be nice as well but can probably work with older versions
Somewhat of a rant but:
Copy code
kotlin.compiler.runViaBuildToolsApi
why do I need a Gradle property in addition to the experimental API?
My
gradle.properties
file is a graveyard of experimental flags. I wish everything was a Kotlin API where the lifecycle can be managed
o
why do I need a Gradle property in addition to the experimental API?
My guess: to enable experimental BTA usage without changing the compiler version. For a more official answer, I will summon @tapchicoma. kodee floating P.S. I've checked Dokka, and we do compile with AV/LV 1.4, Kotlin compiler 2.0.21, and KGP 2.3 (source).
🙌 1
👍 1
m
Thanks! Also again completely sidetracking this discussion but how did you land on 1.4? Is there a published distribution of Gradle versions used by Kotlin developers somewhere? That could be handy to decide what version of Gradle to support. I usually do Gradle 8+ these days but I must say this isn't really backed by actual data.
o
how did you land on 1.4?
That's pretty easy: • Even for the latest KGP (2.3.0), the minimum supported Gradle version is 7.6. (source) • Gradle 7.6 uses LV 1.4. (source) • Dokka should be compatible with all the same versions as KGP. Previously, there was one more requirement: we had a build of stdlib documentation for older versions (like really old: 1.0 and up), which required us to support even older Gradle versions. P.S. DGPv1 currently checks that we have at least Gradle 5.6, though, with Dokka 2.0.0, we support only 7.6 there, as we dropped support for Gradle 6.x in this pr. And yes, for a while we had IT tests running on older Gradle versions! Compatibility in Dokka is a long and complicated story.
👍 1
🙏 2
m
Thanks!
t
JiC: again - take a look into Kotlin Build Tools API and it's ability to use older Kotlin compiler version in a modern KGP: https://kotlinlang.org/docs/build-tools-api.html#compatible-kotlin-compiler-and-kgp-versions
m
Yep, I just did and it worked!
👍 1