Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

melix
Copy link
Contributor

@melix melix commented Feb 26, 2019

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 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.

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.
@johnrengelman johnrengelman added this to the 6.0 milestone Jan 14, 2020
@autonomousapps
Copy link

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 shadow.component() method has nothing actually to do with SoftwareComponents.

@autonomousapps
Copy link

Somewhat related, gradleApi() and localGroovy() are no longer on the compile configuration. They're api now. I had to manually do this to strip them from my shadow jar

configurations["api"].dependencies.remove(dependencies.gradleApi())
configurations["api"].dependencies.remove(dependencies.localGroovy())

@ZacSweers
Copy link

@johnrengelman is there anything further for considering this?

@autonomousapps
Copy link

Was this just released? The release notes for 6.0 say this plugin now supports gradle module metadata.

@johnrengelman
Copy link
Collaborator

It’s being per configured per the release notes but it’s untested....I don’t have the time to dig into the details.
If the spec in this pr exhibits real world desired behavior, then we need to pull it into main.

@johnrengelman johnrengelman modified the milestones: 6.0, 6.1 Oct 5, 2020
@johnrengelman
Copy link
Collaborator

This was included in v6.0.0 with this commit: 5c572a6

Any feedback on real-life usage should be opened as issues.

@autonomousapps
Copy link

That's great! Thanks for pinging.

@autonomousapps
Copy link

I added an issue #611 to provide some feedback. @melix I know this isn't your project, but you have a much deeper understanding of this stuff than I do, could you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants