Support adding excluded dependencies into shadow configuration#2106
Closed
Goooler wants to merge 2 commits into
Closed
Support adding excluded dependencies into shadow configuration#2106Goooler wants to merge 2 commits into
Goooler wants to merge 2 commits into
Conversation
2ea0a8b to
3b809df
Compare
3b809df to
158a241
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in feature to automatically add dependencies excluded from the ShadowJar dependency filter into the shadow configuration (as non-transitive dependencies), improving publishing/runtime metadata behavior for consumers (closes #265).
Changes:
- Introduces
shadow.addExcludedDependenciesToShadowConfiguration(defaultfalse) onShadowExtension. - Implements automatic population of the
shadowconfiguration from ShadowJar’s excluded artifacts. - Adds functional tests covering publishing/application/java plugin scenarios and updates publishing docs + changelog + API dump.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowJavaPlugin.kt | Adds logic to derive excluded artifacts from ShadowJar and add them into shadow as non-transitive dependencies. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowExtension.kt | Adds new extension property with KDoc describing behavior and default. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowBasePlugin.kt | Wires the new property default (convention(false)). |
| src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowPropertiesTest.kt | Verifies the new property defaults to false. |
| src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/JavaPluginsTest.kt | Adds functional coverage for excluded deps (including project deps and classifier artifact preservation). |
| src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/PublishingTest.kt | Ensures publishing emits excluded dependency without transitives (via *:* exclusions). |
| src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt | Ensures installShadowDist includes excluded dependency without transitives. |
| docs/publishing/README.md | Documents the new opt-in behavior and how it interacts with custom shadowJar.configurations. |
| docs/changes/README.md | Adds an Unreleased changelog entry for the new option. |
| api/shadow.api | Updates ABI dump for the new ShadowExtension getter. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+63
to
+71
| tasks.shadowJar.map { shadowJar -> | ||
| val includedFiles = shadowJar.includedDependencies.files | ||
| shadowJar.configurations | ||
| .get() | ||
| .flatMap { it.resolvedConfiguration.resolvedArtifacts } | ||
| .filterNot { it.file in includedFiles } | ||
| .distinctBy { it.id.componentIdentifier to it.file } | ||
| .map { artifact -> createShadowDependency(artifact) } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #265.