Rework the version catalog update task #710
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit completely reworks the version catalog update task. The previous implementation had issues because there was no shared state between passes, so it was impossible to make smarter decisions based on something seen previously.
It also appears that Gradle may, or may not, send all candidates, and the reasons are unclear. This commit changes the algorithm to be stateful instead. It also makes the resolution of metadata parallel, so that the builds are faster.
The algorithm makes sure that candidate versions are passed in order, from the latest release to the oldest one. Subclasses may decide to reject a candidate, in which case the next one will be tested, or they may accept it as a fallback, in which case all versions can potentially be tested. If a version is accepted, then the loop is interrupted and no other candidate is tested.