Skip to content

Commit e58e09b

Browse files
committed
Mention eachFile and filesNotMatching
1 parent 74651fb commit e58e09b

File tree

2 files changed

+6
-12
lines changed
  • docs/configuration/merging
  • src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks

2 files changed

+6
-12
lines changed

docs/configuration/merging/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ to take:
8585
1. Set the strategy to `INCLUDE` or `WARN`.
8686
2. Apply your [`ResourceTransformer`][ResourceTransformer]s.
8787
3. Remove duplicate entries by
88-
- overriding the default strategy for specific files using [`filesMatching`][Jar.filesMatching]
88+
- overriding the default strategy for specific files using [`filesMatching`][Jar.filesMatching] or [`eachFile`][Jar.eachFile] functions
8989
- or applying [`PreserveFirstFoundResourceTransformer`][PreserveFirstFoundResourceTransformer] for specific files
9090
- or write your own [`ResourceTransformer`][ResourceTransformer] to handle duplicates
9191
- or mechanism similar.
@@ -451,6 +451,7 @@ It must be added using the [`transform`][ShadowJar.transform] methods.
451451

452452

453453
[AbstractCopyTask]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.AbstractCopyTask.html
454+
[Jar.eachFile]: https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:eachFile(org.gradle.api.Action)
454455
[Jar.filesMatching]: https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:filesMatching(java.lang.Iterable,%20org.gradle.api.Action)
455456
[AppendingTransformer]: ../../api/shadow/com.github.jengelman.gradle.plugins.shadow.transformers/-appending-transformer/index.html
456457
[DuplicatesStrategy]: https://docs.gradle.org/current/javadoc/org/gradle/api/file/DuplicatesStrategy.html

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,12 @@ public abstract class ShadowJar : Jar() {
219219
* **NOTE:** The strategy takes precedence over transforming and relocating.
220220
* Some [ResourceTransformer]s like [ServiceFileTransformer] will not work as expected with setting the strategy to
221221
* [EXCLUDE] (the default), as the duplicate resource files fed for them are excluded beforehand.
222-
* Want [ResourceTransformer]s and the strategy to work together? There are several steps to take:
223-
*
224-
* 1. Set the strategy to [INCLUDE] or [WARN].
225-
* 2. Apply your [ResourceTransformer]s.
226-
* 3. Remove duplicate entries by
227-
* - overriding the default strategy for specific files using [filesMatching]
228-
* - or applying `PreserveFirstFoundResourceTransformer` for specific files
229-
* - or write your own `ResourceTransformer`s to handle duplicates
230-
* - or mechanism similar.
231-
* 4. Optionally, enable [failOnDuplicateEntries] to check duplicate entries in the final JAR.
232-
* 5. Optionally, use [Diffuse](https://github.com/JakeWharton/diffuse) to diff the JARs.
222+
* Want [ResourceTransformer]s and the strategy to work together? See more details in the
223+
* [Handling Duplicates Strategy](https://gradleup.com/shadow/configuration/merging/#handling-duplicates-strategy) section.
233224
*
225+
* @see [eachFile]
234226
* @see [filesMatching]
227+
* @see [filesNotMatching]
235228
* @see [DuplicatesStrategy]
236229
* @see [CopySpec.duplicatesStrategy]
237230
*/

0 commit comments

Comments
 (0)