Skip to content

Check DuplicatesStrategy for merging transformers#2026

Draft
Goooler wants to merge 2 commits into
mainfrom
g/20250515/check-dup-strategy-in-transformers
Draft

Check DuplicatesStrategy for merging transformers#2026
Goooler wants to merge 2 commits into
mainfrom
g/20250515/check-dup-strategy-in-transformers

Conversation

@Goooler

@Goooler Goooler commented May 15, 2026

Copy link
Copy Markdown
Member

@Goooler Goooler force-pushed the g/20250515/check-dup-strategy-in-transformers branch from d19e885 to 7250a6c Compare May 15, 2026 12:10
@Goooler Goooler force-pushed the g/20250515/check-dup-strategy-in-transformers branch 2 times, most recently from 3266595 to 138cf68 Compare June 22, 2026 11:01
@Goooler Goooler force-pushed the g/20250515/check-dup-strategy-in-transformers branch from deae156 to be794bd Compare June 23, 2026 05:09
@Goooler Goooler changed the title Check DuplicatesStrategy for merging transformers Check DuplicatesStrategy for merging transformers Jun 23, 2026
@Goooler Goooler requested a review from Copilot June 23, 2026 05:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 whose DuplicatesStrategy is EXCLUDE.
  • 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.

Comment thread docs/changes/README.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

This tortured and broken sentence in the docs cost me hours of troubleshooting.

2 participants