littlerobots / version-catalog-update-plugin

Gradle plugin for updating a project version catalog
Apache License 2.0
565 stars 23 forks source link

Keep version ref used in buildScript #38

Closed Lawhacknifemi closed 2 years ago

Lawhacknifemi commented 2 years ago

I'm thrilled to discover this plugin , it solves most of my use cases except not keeping comments (which I believe there is an open issue for) . I would also like to keep version references that's isn't directly used in the time file but used in the Gradle build script. As an example minSDK = "21", this version is used in the Android Gradle block , but when I run ./gradlew updateVersionCatalog it got deleted, I will however like to keep such versions as they not entirely "un-used version" . For now the walk around is to pin them . But I think it will be cool if the plugin support them out of the box

hvisser commented 2 years ago

This is exactly what the keep option is for, since a version is not something that is detected by the versions plugin it will be cleaned up if not used in a dependency declaration. So using keep in the configuration and specifying the version(s) you'd like to keep is correct.

hvisser commented 2 years ago

Starting with 0.4.0 you can do this by adding a comment to to the toml file like this

[versions]
# @keep
minSdk = "21
Lawhacknifemi commented 2 years ago

This is really good in in terms of developer experience. Cool stuff 🔥