hello people, Anyone using kotlin DSL to manage gr...
# android
s
hello people, Anyone using kotlin DSL to manage gradle builds? Is it worth it? What impact does it have in build speed?
r
Getting rid of the Groovy nightmare is always worth it. I don’t think Groovy vs Kotlin as the script language has any meaningful impact on build speed
r
There def is a impact on build speeds lol. For a prod app, I dont think I would suggest it
3
g
I link an issue from YouTrack about the build speed since you requested it: https://youtrack.jetbrains.com/issue/KT-24668 BTW we have a project with around 100 Gradle modules and we tried to switch to kotlin dsl but since sometimes we had some bugs and we had to switch it back to groovy, we decided to convert only our
buildSrc
plugins and tasks to Kotlin DSL and leave the rest in Groovy ATM.
s
yes. Slower as expected... and if it still has bugs I think I'll pass for now. Thank you. Maybe later when it's more stable. A good idea would be to have an automatic converter as with java to kotlin.
👍 1
c
I would say that the speed different is noticible only if you profile the build. If you’re casually using Gradle from the command line, you probably won’t notice much of a difference. The main hit to performance is the initial startup as it compiles the Kotlin, but the runtime beyond that is pretty much the same as Groovy
And regardless of build speed, feeling like I can actually do stuff in my build scripts with Kotlin’s strong typing is 100% worth the hit to performance
Also, from my experience, you’ll have a much better time using Kotlin DSL on new projects that aren’t already burdened by Groovy scripts. It’s pretty difficult to convert Groovy scripts to Kotlin, especially for large multi-module projects. But if you start in Kotlin, it’s pretty easy to keep everything in Kotlin
👍 6
g
@lucas.moresco