Do not check all-service endpoint if exact version requested #5737
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.
What's changed?
The https://services.gradle.org/versions/all endpoint is really only needed to determine the latest version available if a version wildcard notation (e.g. 8.x) or null has been requested by the end user. In all other cases, we are making an unnecessary HTTPS call.
Side note: The
repositoryUrl
always used the null value. I removed the parameter to make the logic less confusing.What's your motivation?
Many declarative recipes add the UpdateGradleWrapper recipe and provide a specific version as a default value. For example, the MigrateToGradle8 recipe sets the version option value to 8.x.
Within enterprises, the https://services.gradle.org endpoint is often times not exposed. Calling the endpoint simply results in a failure after running into a HTTP timeout or by not being able to resolve it. End users usually do not know that the Wrapper distribution needs to be resolved from an in-house binary repository; nevertheless they execute the recipe with the default values. For scenarios where the user provided an exact version, we'll increase the performance of the recipe execution.
Anything in particular you'd like reviewers to focus on?
No