-
Notifications
You must be signed in to change notification settings - Fork 6
Migrate Gradle Groovy (*.gradle) to Gradle Kotlin (*.gradle.kts) #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate Gradle Groovy (*.gradle) to Gradle Kotlin (*.gradle.kts) #61
Conversation
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
when (it) { | ||
ProfileState.SIGN_OUT_FAILURE -> showError(viewModel.error) | ||
ProfileState.SIGN_OUT_SUCCESS -> goToFirstScreen() | ||
viewModel.state.observe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use it like above?
viewModel.state.observe(this) {
}
viewModel.state.observe( | ||
this | ||
) { | ||
it?.run { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcossalto looks like you added two new modules, could you explain a little bit more in the PR description these changes, before approval, also I'd documented these changes in the Readme file including a link to Gradle Kotlin
docs to learn more about it.
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