man, it is really gd difficult to write a precompi...
# gradle
b
man, it is really gd difficult to write a precompiled script plugin that uses a later version of kotlin than is bundled in gradle.
m
Not only it is difficult but I think it's impossible ? You might be able to use some language features like sealed interfaces but using any 1.5 stdlib api will most likely break at runtime ?
j
I am using Kotlin 1.5.10 and I have tons of precompiled plugins with no issues (even some of them published to maven central) 🤔 (Gradle 7)
b
The caveat is you must be using the latest gradle versions to have the plugins play happy. Sometimes not the easiest =/
j
Gradle 7 is using Kotlin 1.4 under the hood
v
Not only under the hood. 6.8 already used 1.4 under the hood but for backwards compatibility compiled build scripts with 1.3 language level and api. 7.0 switched the latter to 1.4 too. But I also used Kotlin 1.4 Gradle plugin in Gradle 6.7 and earlier without problem. I got the bulky warning about incompatible version on the class path, but everything worked as expected.
m
Kotlin 1.5 plugins + Gradle 7 works as long as the plugin is compiled using apiLevel=1.4, right? If I try to call
String.uppercase()
inside a Gradle plugin I'd expect a runtime exception?
v
I have no idea, could well be, just TIAS 🙂
m
So basically it's safe as long as you don't use the new APIs
b
yeah, it should be safe, it just is really annoying that it spits out so many warnings if i have kotlin-1.5 as a runtime dependency (so i can apply it in my precompiled script convention plugin)