android / nowinandroid

A fully functional Android app built entirely with Kotlin and Jetpack Compose
Apache License 2.0
17.38k stars 3.17k forks source link

[FR]: Use gradle version catalog's type-safe accessors in `build-logic` #317

Open AfigAliyev opened 2 years ago

AfigAliyev commented 2 years ago

Is there an existing issue for this?

Describe the problem

Currently, build-logic uses the gradle version catalog without type-safe accessors and the names of libraries and plugins are hard-coded.

For example, the AndroidFeatureConventionPlugin has the following code snippet:

dependencies {
    add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get())
    add("implementation", libs.findLibrary("androidx.lifecycle.runtimeCompose").get())
    add("implementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get())
}

Describe the solution

With the gradle version catalog's type-safe accessors, the above code snippet can be replaced with:

dependencies {
    add("implementation", libs.androidx.hilt.navigation.compose)
    add("implementation", libs.androidx.lifecycle.runtimeCompose)
    add("implementation", libs.androidx.lifecycle.viewModelCompose)
}

Additional context

No response

Code of Conduct

alexvanyo commented 2 years ago

Per the comments in #318 , we want to wait until this is officially supported by Gradle without using a workaround that might be brittle.