Add PreserveFirstFoundResourceTransformer#1548
Conversation
|
Noted the breaking change in #1547, we can't set the strategy back as it fails the transformers. https://scans.gradle.com/s/ul6xobwusbbwm/tests/overview?outcome=FAILED |
|
May need to add a new transformer to prevent duplicate files to fallback the case like GrimAnticheat/Grim#2229 (comment). |
This reverts commit 6e24d64.
PreserveFirstFoundResourceTransformer
...github/jengelman/gradle/plugins/shadow/transformers/PreserveFirstFoundResourceTransformer.kt
Outdated
Show resolved
Hide resolved
…nsformers/PreserveFirstFoundResourceTransformer.kt
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new PreserveFirstFoundResourceTransformer class that provides a way to handle duplicate resources by preserving only the first instance found. This is particularly useful when using the default DuplicatesStrategy.INCLUDE and wanting to ensure only the first found resource (typically from the project itself) is included in the final JAR.
Key changes:
- Implements a new transformer that tracks found resources and excludes subsequent duplicates
- Adds comprehensive functional tests to verify the transformer behavior
- Updates documentation to reference the new transformer
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
PreserveFirstFoundResourceTransformer.kt |
New transformer implementation with resource tracking logic |
TransformersTest.kt |
Functional test verifying the transformer preserves first found resources |
docs/configuration/merging/README.md |
Documentation update referencing the new transformer |
docs/changes/README.md |
Changelog entry documenting the addition |
api/shadow.api |
API definition for the new transformer class |
Closes #1357.