Skip to content

Commit

Permalink
Apply legacy plugin last, and declare capabilities for old plugins (#991
Browse files Browse the repository at this point in the history
)

Co-authored-by: Zongle Wang <[email protected]>
  • Loading branch information
jpenilla and Goooler authored Oct 24, 2024
1 parent b0842f2 commit 8aad9ad
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
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 {
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")
}
3 changes: 3 additions & 0 deletions src/docs/changes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

## [Unreleased]

**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.3]

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)

boolean enableDevelocityIntegration = providers.gradleProperty(
"com.gradleup.shadow.enableDevelocityIntegration"
Expand Down

0 comments on commit 8aad9ad

Please sign in to comment.