Skip to content

Commit 605bb13

Browse files
authored
Remove eachFile stuff (#1592)
1 parent b71a441 commit 605bb13

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

docs/configuration/merging/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,15 +430,14 @@ as expected because the `duplicatesStrategy` will exclude the duplicate service
430430
Want [`ResourceTransformer`][ResourceTransformer]s and `duplicatesStrategy` to work together? There are several ways to
431431
do it:
432432

433-
- Use [`eachFile`][Jar.eachFile] or [`filesMatching`][Jar.filesMatching] to override the strategy for specific files.
433+
- Use [`filesMatching`][Jar.filesMatching] to override the strategy for specific files.
434434
- Keep `duplicatesStrategy = INCLUDE` and write your own [`ResourceTransformer`][ResourceTransformer] to handle duplicates.
435435

436436
If you just want to keep the current behavior and preserve the first found resources, there is a simple built-in one
437437
called [`PreserveFirstFoundResourceTransformer`][PreserveFirstFoundResourceTransformer].
438438

439439

440440
[AbstractCopyTask]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.AbstractCopyTask.html
441-
[Jar.eachFile]: https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:eachFile(groovy.lang.Closure)
442441
[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)
443442
[AppendingTransformer]: ../../api/shadow/com.github.jengelman.gradle.plugins.shadow.transformers/-appending-transformer/index.html
444443
[DuplicatesStrategy]: https://docs.gradle.org/current/javadoc/org/gradle/api/file/DuplicatesStrategy.html

src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -225,28 +225,7 @@ class ServiceFileTransformerTest : BaseTransformerTest() {
225225
}
226226

227227
@Test
228-
fun strategyExcludeCanBeOverriddenByEachFile() {
229-
writeDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
230-
projectScriptPath.appendText(
231-
"""
232-
$shadowJar {
233-
eachFile {
234-
duplicatesStrategy = DuplicatesStrategy.INCLUDE
235-
}
236-
}
237-
""".trimIndent(),
238-
)
239-
240-
run(shadowJarTask)
241-
242-
assertThat(outputShadowJar).useAll {
243-
getContent(ENTRY_SERVICES_SHADE).isEqualTo(CONTENT_ONE_TWO)
244-
getContent(ENTRY_SERVICES_FOO).isEqualTo("one\ntwo")
245-
}
246-
}
247-
248-
@Test
249-
fun strategyExcludeCanBeOverriddenByFileMatching() {
228+
fun strategyExcludeCanBeOverriddenByFilesMatching() {
250229
writeDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
251230
projectScriptPath.appendText(
252231
"""

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public abstract class ShadowJar : Jar() {
196196
/**
197197
* Returns the strategy to use when trying to copy more than one file to the same destination.
198198
*
199-
* This strategy can be overridden for individual files by using [eachFile] or [filesMatching].
199+
* This strategy can be overridden for individual files by using [filesMatching].
200200
*
201201
* The default value is [INCLUDE]. Different strategies will lead to different results for
202202
* `foo/bar` files in the JARs to be merged:
@@ -212,13 +212,12 @@ public abstract class ShadowJar : Jar() {
212212
* [EXCLUDE], as the service files are excluded beforehand. Want [ResourceTransformer]s and the strategy to work
213213
* together? There are several ways to do it:
214214
*
215-
* - Use [eachFile] or [filesMatching] to override the strategy for specific files.
215+
* - Use [filesMatching] to override the strategy for specific files.
216216
* - Keep `duplicatesStrategy = INCLUDE` and write your own [ResourceTransformer] to handle duplicates.
217217
*
218218
* If you just want to keep the current behavior and preserve the first found resources, there is a simple built-in one
219219
* called [PreserveFirstFoundResourceTransformer].
220220
*
221-
* @see [eachFile]
222221
* @see [filesMatching]
223222
* @see [DuplicatesStrategy]
224223
* @see [CopySpec.duplicatesStrategy]

0 commit comments

Comments
 (0)