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

Merged
merged 6 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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(
Goooler marked this conversation as resolved.
Show resolved Hide resolved
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))
Goooler marked this conversation as resolved.
Show resolved Hide resolved

## [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