https://kotlinlang.org logo
#android
Title
# android
s

Saurabh Thorat

06/11/2020, 7:33 PM
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

dephinera

06/11/2020, 7:38 PM
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

Brian Dilley

06/11/2020, 7:59 PM
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

dephinera

06/11/2020, 8:01 PM
Well Android Studio is a modified IntelliJ, Kotlin is made by jetbrains, so I suspect you should have a very decent support
g

gammax

06/11/2020, 8:03 PM
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

Gabriel Feo

06/11/2020, 10:59 PM
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

Ryan

06/12/2020, 12:14 AM
been using kotlin dsl for about a year, i can’t go back.
t

thanksforallthefish

06/12/2020, 6:11 AM
@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")