In Android Studio, Gradle build scripts in our project structure use Groovy build language. We mainly define plugins, project settings and dependencies in our Gradle scripts.
Writing code in these Gradle scripts doesn't seem excited since we're not very familiar with Groovy language.
A Kotlin build script can contain any Kotlin language element.
Since most of us use Kotlin for development, it's easier and more flexible to have build scripts in Kotlin instead of Groovy.
Kotlin DSL is based on the Kotlin core language. So the syntax is the same as the parent language, which gives us the benefit of using Kotlin for development. Kotlin DSL is fully compatible with Android Studio.
For that reason we find interesting migrating Groovy build scripts (.gradle) to Kotlin build scripts (.gradle.kts) for better reusability and easy maintenance
Tasks
Updated Koin library to 3.1.3
Updated KtLint library to 0.44.0
Optimized buildSrc module for Gradle Dependencies Management
Updated App name
Optimized app for Android 12
Added pre-push GitHook
Notes
We can list some benefits of choosing Kotlin DSL over Groovy
Good readability
Easily adaptable Kotlin syntax from the parent language
Description
In Android Studio, Gradle build scripts in our project structure use Groovy build language. We mainly define plugins, project settings and dependencies in our Gradle scripts. Writing code in these Gradle scripts doesn't seem excited since we're not very familiar with Groovy language. A Kotlin build script can contain any Kotlin language element.
Since most of us use Kotlin for development, it's easier and more flexible to have build scripts in Kotlin instead of Groovy. Kotlin DSL is based on the Kotlin core language. So the syntax is the same as the parent language, which gives us the benefit of using Kotlin for development. Kotlin DSL is fully compatible with Android Studio.
For that reason we find interesting migrating Groovy build scripts (.gradle) to Kotlin build scripts (.gradle.kts) for better reusability and easy maintenance
Tasks
Notes
We can list some benefits of choosing Kotlin DSL over Groovy
Gradle Dependencies Management
We use buildSrc + Kotlin DSL For more information, please visit Gradle Kotlin DSL Primer