-
Notifications
You must be signed in to change notification settings - Fork 5k
Remove restriction on subgroups in version catalogs #17357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In previous releases, it wasn't possible to declare a version catalog alias which was an intermediate node, but also provided a value. For example, this was invalid (using TOML but the API had the same restrictions): [libraries] top="org:foo:1.0" top.bottom="org:bar:1.0" The reason is that we need the leaves to be providers and there's no custom implementation of a provider for dependency notations (custom implementations are expensive to maintain and should be avoided). To workaround this problem, this commit introduces an interface, `ProviderConvertible`, which is implemented by intermediate nodes which also provide a value. This interface provides a single method, `asProvider()`, which is transparently called by Gradle when such a notation is added as a dependency: implementation(libs.top) // libs.top implements ProviderConvertible so this is equivalent to writing: implementation(libs.top.asProvider()) And accessing the leaf is possible as before using: implementation(libs.top.bottom) Fixes #17170
This commit fixes a null pointer exception whenever a catalog references aliases using different separators than what was expected. This was accidentally found when fixing the nested alias structure, which in some cases may use the wrong alias because it builds paths using `.` instead of what would be declared in a catalog. Now it doesn't matter how the client asks for an alias/bundle/version: it is always normalized when building the catalog or querying it.
So that the written aliases are always normalized to the TOML format (using `-` instead of `.`).
ljacomet
approved these changes
Jun 7, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Can you also add something to the release notes for these changes?
bot-gradle
added a commit
that referenced
this pull request
Jun 8, 2021
Remove restriction on subgroups in version catalogs
Pre-tested commit build failed. |
OK, I've already triggered a build for you. |
@bot-gradle test and merge |
Your PR is queued. See the queue page for details. |
OK, I've already triggered a build for you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 PR removes the restriction that you cannot have an alias which is both an accessor for a dependency (or version or bundle) and a subaccessor for other dependencies. This is now allowed:
Fixes #17170