Hi, trying to use value classes in 1.5 but it's sa...
# gradle
e
Hi, trying to use value classes in 1.5 but it's saying i need @JvmInLine. But it can't resolve it. Have a feeling in need to turn some thing on. Using gradle Kotlin dsl.
p
Are you sure you are on Kotlin 1.5? Afaik Gradle 7.0 bundles Kotlin 1.4.31 so kotlin-dsl gradle plugin probably misses the annotation on classpath.
e
Have some problems on that as well. Getting the one in this channel whit build source and gradle
I have my gradle-plugin set in dependencies to 1.5.0 in the buildSrc build script. The idea was to sync the project and Kotlin version via convention plugins
Think im just giving up on 1.5 for now, not finding any good way to fix this
e
if you're trying to use Kotlin 1.5 inside buildSrc, basically you can't, the version bundled with Gradle's Kotlin DSL overrides it. https://github.com/gradle/gradle/issues/16345
e
The Kotlin dsl can be 1.4 but i want the code that i build to be 1.5. but it looks like the convention plugin i have in buildSrc just get confused
c
if you post your root build.gradle.kts and buildSrc/build.gradle.kts maybe someone can help you figure out whats up
e
yes, it is challenging to build convention plugins with Kotlin for Kotlin due to this issue. you can try forcing dependencies.stdlib and kotlinOptions.api-language in buildSrc/build.gradle(.kts) but no guarantees that will work.
e
Don't have a root file. The buildSrc build gradel is basic. It has the Kotlin version i want to use and the Kotlin gradle plugin as a dependensy to set the version to 1.5 as the convention plugin blocks me from that
Now i have a crash from the compiler on value classes. So it's probably still using the wrong compiler but the librarys are 1.5
e
your buildSrc module needs to run on Kotlin 1.4 to work inside Gradle, even when it's defining a convention plugin that uses Kotlin 1.5. hence, try to override the language api version and stdlib dependencies in buildSrc/build.gradle. that doesn't affect what the plugin applies to your real build, just how the plugin itself works.
e
In the convention plugin gradle.kts it wont let you set the kotlin("jvm") version 1.5 så the awnser i got last time was to set in the build.gradle.kts file in buildSrc root to have the kotlin-dsl plugin and add implementation (kotlin ("gradle-plugin", version="1.5.0"))
In the convention plugin i have added the dependensy and set lanuagesSettings on the source set
p
What are you trying to do? It is not possible to write kotlin-dsl in kotlin 1.5 with gradle 7.0 simple as that
e
Im trying to upgrade a big project to Kotlin 1.5. there are may modules so we are using gradle convention plugins to sync libraries and versions
So basically i vant 1.5 for the project, the Kotlin-dsl can stay what is has to be
p
Understandable, yet this is exactly an issue here. You can’t, until Gradle migrates to bundling Kotlin 1.5. There are hacks possible but YMMV. Gradle doesn’t isolate old kotlin compiler during kotlin-dsl script evaluation at buildSrc folder and enforces old kotlin into your project classpath • https://youtrack.jetbrains.com/issue/KT-41142https://github.com/gradle/gradle/issues/16345
e
Thanks, this is annoying. I guess we will keep on 1.4 until next maintenance window when Java 17 release hopefully this is fixed by then