littlerobots / version-catalog-update-plugin

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

Extract updateCatalog logic to proper methods #46

Closed GabriellCosta closed 2 years ago

GabriellCosta commented 2 years ago

updateCatalog Method was doing a lot of different stuff like creating the new catalog and updating the catalog, so I extracted this logic to proper methods

getCurrentCatalog method return a instance of the current VersionCatalog

getUpdatedCatalog method return update the VersionCatalog

Motivation


I want to add support for multiple toml updates, creating a PR doing all this changes would be to hard to validate, so I'm sending this one first

hvisser commented 2 years ago

Thanks for this PR, as you mention it's a relatively small change.

Re: multiple toml files, it looks like the direction you are heading in is to handle multiple files within the task, but if you configure multiple tasks manually, multiple toml files are already supported without any changes today. Having a single task updating a single toml file also has benefits for (unit) testing and the ability to only update a single file for example.

I'm curious to the use cases for multiple toml files, I can think of a few but it might be good to create an issue to see what support is needed in the plugin, also so that others can chime into that discussion.

Given the above I'm not sure if it makes sense to merge this PR, though I haven't had the time to look at it in detail.