Open FyiurAmron opened 1 year ago
I've run into this as an actual issue: Running the versionCatalogFormat
task resulted in a version for androidx-test
being added and used in the [libraries]
section. However, the current version of those three dependencies in my project being the same is due to a coincidence: Each dependency is actually released on its own, but right now they happen to have the same version.
Anyway, since this isn't configurable yet, I applied the following workaround:
A proper upstream change to allow this would probably be to make execution of this line conditional based on some configuration: https://github.com/littlerobots/version-catalog-update-plugin/blob/32f7d9b0d0de36d517b37f4005ca311a839dd6cf/catalog/src/main/kotlin/nl/littlerobots/vcu/model/VersionCatalog.kt#L126
I'm still not really eager to make this configurable as it adds to the complexity of the plugin (config, testing etc). The generation of version refs is there for convenience but it needs to use a heuristic to do the grouping, since there's no way to know for sure how dependencies are released. I've also observed that most folks want a version.ref
, even for dependencies that don't strictly need it. The plugin wil retain those version groups (the line you are pointing to).
In this particular case you could do two things:
version.ref
for that specific entry. The plugin will keep that version ref for future updates.Though if you feel very strong about making this configurable, I'm happy to take a PR for it. Please add tests too in that case :) I currently don't have the bandwidth to work on it.
In some cases, the explicit versioning is easier to manage (e.g. with external tooling). It would be good to be able to disable the generation of version.refs and force explicit version strings in the generated entries instead.