Sad that there is no option to generate a new proj...
# android
d
Sad that there is no option to generate a new project's Gradle files in Kotlin DSL, in Android Studio - this seems like a benchmark for adoption.
g
Most of AS tooling related to build.gradle is not working with Kotlin DSL, even basic ones, like reimport of project which generates build.gradle near your build.gradle.kts, so I believe there is long path until they add it
2
a
After you've done it a time or two on a new project it's not that difficult or time consuming. But the order of steps is important. I could never remember that so I documented the process as I went through it and wrote a gist to remind myself. https://gist.github.com/alwarren/28f292e59d241cea4c816eefff18d681
g
Copy code
tasks{
    val clean by registering(Delete::class) {
        delete(buildDir)
    }
}
registering<Delete>("clean")
Anyway, there is great official migration guide: https://guides.gradle.org/migrating-build-logic-from-groovy-to-kotlin/
r
It's not ready yet.
g
Kotlin DSL is pretty much fine now, but stable AS is still on IDEA 2018.*, some important fixes available only on 2019 Also I believe AS tooling is bigger problem than Kotlin DSL itself
a
@gildor On the clean task, that was sort of the point I was trying to make in the gist notes where I mentioned things can be version dependent. I had a hard time even following documentation because of that. I had already tried
registering<Delete>("clean")
but it didn't compile for whatever reason at the time.
g
oh, sorry, I meant
register<Delete>("clean")
a
I think I tried that too. 🤣
g
Hm, works for me
a
Might have been a version specific thing at the time I tried it. Or maybe I was looking at wrong documents for the version I was using. Hard to tell.