Check DuplicatesStrategy for merging transformers#2026
Draft
Goooler wants to merge 2 commits into
Draft
Conversation
d19e885 to
7250a6c
Compare
3266595 to
138cf68
Compare
deae156 to
be794bd
Compare
DuplicatesStrategy for merging transformers
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a centralized warning mechanism to help users detect when DuplicatesStrategy.EXCLUDE may prevent ResourceTransformers from seeing all duplicate resources (and therefore from merging/deduplicating as intended), addressing confusion reported in #1884 / #2022.
Changes:
- Introduces
checkDupStrategy(...)to emit a warning when a transformer matches a resource whoseDuplicatesStrategyisEXCLUDE. - Hooks this check into multiple built-in transformers’
canTransformResource(...)implementations. - Extends functional coverage for
mergeServiceFiles()behavior and updates the Unreleased changelog.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/XmlAppendingTransformer.kt | Calls checkDupStrategy when matching resources for XML appending. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/PropertiesFileTransformer.kt | Calls checkDupStrategy for properties resource matching. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/PreserveFirstFoundResourceTransformer.kt | Adds duplicates-strategy checking when pattern-matching resources. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/PatternFilterableResourceTransformer.kt | Adds duplicates-strategy checking to the base pattern-filterable transformer. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/DeduplicatingResourceTransformer.kt | Adds duplicates-strategy checking for deduplication transformer matching. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/AppendingTransformer.kt | Calls checkDupStrategy when matching resources for plain appending. |
| src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/internal/DuplicatesStrategyChecker.kt | New shared helper that detects EXCLUDE and logs a warning. |
| src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt | Asserts warnings are emitted for EXCLUDE when mergeServiceFiles() is enabled. |
| docs/changes/README.md | Documents the new warning behavior in Unreleased changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Uh oh!
There was an error while loading. Please reload this page.