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

Apply legacy plugin last, and declare capabilities for old plugins #991

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions build-logic/src/main/kotlin/shadow.convention.publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,34 @@ tasks.withType<Javadoc>().configureEach {
it.addStringOption("Xdoclint:none", "-quiet")
}
}

configurations {
sequenceOf(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sequenceOf(
listOf(

apiElements,
runtimeElements,
named("javadocElements"),
named("sourcesElements"),
).forEach {
it.configure {
outgoing {
// Main/current capability
capability("com.gradleup.shadow:shadow-gradle-plugin:$version")

// Historical capabilities
capability("io.github.goooler.shadow:shadow-gradle-plugin:$version")
capability("com.github.johnrengelman:shadow:$version")
capability("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:$version")
capability("gradle.plugin.com.github.johnrengelman:shadow:$version")
capability("com.github.jengelman.gradle.plugins:shadow:$version")
}
}
}
}

publishing.publications.withType<MavenPublication>().configureEach {
// We don't care about capabilities being unmappable to Maven
suppressPomMetadataWarningsFor("apiElements")
suppressPomMetadataWarningsFor("runtimeElements")
suppressPomMetadataWarningsFor("javadocElements")
suppressPomMetadataWarningsFor("sourcesElements")
}
1 change: 1 addition & 0 deletions src/docs/changes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

## [Unreleased]

- Apply legacy plugin last, and declare capabilities for old plugins, fixes [#964](https://github.com/GradleUp/shadow/issues/964) ([#991](https://github.com/GradleUp/shadow/pull/991))
Copy link
Member

@Goooler Goooler Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Apply legacy plugin last, and declare capabilities for old plugins, fixes [#964](https://github.com/GradleUp/shadow/issues/964) ([#991](https://github.com/GradleUp/shadow/pull/991))
**Fixed**
- Apply legacy plugin last, and declare capabilities for old plugins, fixes [#964](https://github.com/GradleUp/shadow/issues/964). ([#991](https://github.com/GradleUp/shadow/pull/991))


## [v8.3.2]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ class ShadowPlugin implements Plugin<Project> {
void apply(Project project) {
project.with {
plugins.apply(ShadowBasePlugin)
plugins.apply(LegacyShadowPlugin)
plugins.withType(JavaPlugin) {
plugins.apply(ShadowJavaPlugin)
}
plugins.withType(ApplicationPlugin) {
plugins.apply(ShadowApplicationPlugin)
}
// Apply the legacy plugin last
// Because we apply the ShadowJavaPlugin/ShadowApplication plugin in a withType callback for the
// respective JavaPlugin/ApplicationPlugin, it may still apply before the shadowJar task is created and
// etc. if the user applies shadow before those plugins. However, this is fine, because this was also
// the behavior with the old plugin when applying in that order.
plugins.apply(LegacyShadowPlugin)

// Legacy build scan support for Gradle Enterprise, users should migrate to develocity plugin.
rootProject.plugins.withId('com.gradle.enterprise') {
Expand Down