-
Notifications
You must be signed in to change notification settings - Fork 397
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
Add support for Gradle metadata #461
Conversation
This commit adds support for Gradle metadata, available in Gradle 5.3+. First, it makes use of the new public publication API to create a custom software component. This software component is registered so that when published, we publish both the normal jars _and_ the shadow jar. When Gradle metadata is enabled, we also publish Gradle metadata, which will declare variants for all usages. In particular, it makes use of the `Bundling` attribute to tell Gradle that this particular variant is a shadow jar. This makes it possible for consumers to _choose_ whatever dependency they want: either the regular jar, or the shadow one. It's worth noting that for Maven consumers, they would have to rely on the classifier to get the all jar.
6d7e39f
to
dffd507
Compare
What's the status of this? I just spent several hours yesterday trying to use shadow to help bundle some dependencies into my gradle plugin before finally realizing that the |
Somewhat related, configurations["api"].dependencies.remove(dependencies.gradleApi())
configurations["api"].dependencies.remove(dependencies.localGroovy()) |
@johnrengelman is there anything further for considering this? |
Was this just released? The release notes for 6.0 say this plugin now supports gradle module metadata. |
It’s being per configured per the release notes but it’s untested....I don’t have the time to dig into the details. |
This was included in v6.0.0 with this commit: 5c572a6 Any feedback on real-life usage should be opened as issues. |
That's great! Thanks for pinging. |
Context
This PR is not ready and only there to demonstrate the
potential of Gradle metadata. Open for discussion.
This commit adds support for Gradle metadata, available in
Gradle 5.3+. First, it makes use of the new public publication
API to create a custom software component.
This software component is registered so that when published,
we publish both the normal jars and the shadow jar. When
Gradle metadata is enabled, we also publish Gradle metadata,
which will declare variants for all usages. In particular,
it makes use of the
Bundling
attribute to tell Gradle thatthis particular variant is a shadow jar.
This makes it possible for consumers to choose whatever
dependency they want: either the regular jar, or the shadow
one. It's worth noting that for Maven consumers, they would
have to rely on the classifier to get the all jar.