What do you guys think about Gradle Kotlin DSL mig...
# android
s
What do you guys think about Gradle Kotlin DSL migration? The last time I tried it a few months ago, it wasn’t worth the hassle. IDE support wasn’t that great then, I needed additional plugins to check dependency updates and it was lacking good documentation. But now it seems Google has started using it in their I/O 2020 app. Makes me want to try it again.
d
Android Studio 4 adds support for Kotlin DSL script files. I've been wanting to switch to Kotlin DSL for a long time to have a more consistent code we're looking at
b
I want to switch too, but we use Kotlin for server stuff so i wonder how well it’s supported in non-android studio
d
Well Android Studio is a modified IntelliJ, Kotlin is made by jetbrains, so I suspect you should have a very decent support
g
If you use it you get a couple of nice features (ktlint will reformat it, autocompletion and a bit of semantic editing). On the other sometimes is a bit painful to convert snippets of gradle/groovy code you find around as the Kotlin equivalent is not straightforward
g
Things are better with Studio 4.0, I use it. The Kotlin DSL with buildSrc is pretty good. Nicola makes a good point, although I do enjoy translating the snippet or figuring another way out
r
been using kotlin dsl for about a year, i can’t go back.
t
@Brian Dilley we have one project using kotlin dsl for a be application and one using groovy, I am personally happier than with groovy. official documentation offers snippets for both. for plugin not supporting the kotlin dsl I ended up using supporting groovy based gradle file and using
apply(from=)
, ie
apply(from = "openapi.gradle")