nowinandroid icon indicating copy to clipboard operation
nowinandroid copied to clipboard

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

Open AfigAliyev opened this issue 3 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

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

  • [X] I agree to follow this project's Code of Conduct

AfigAliyev avatar Oct 03 '22 18:10 AfigAliyev

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

alexvanyo avatar Oct 10 '22 14:10 alexvanyo