diff --git a/docs/configuration/merging/README.md b/docs/configuration/merging/README.md index 3c6405237..63b82dff7 100644 --- a/docs/configuration/merging/README.md +++ b/docs/configuration/merging/README.md @@ -430,7 +430,7 @@ as expected because the `duplicatesStrategy` will exclude the duplicate service Want [`ResourceTransformer`][ResourceTransformer]s and `duplicatesStrategy` to work together? There are several ways to do it: -- Use [`eachFile`][Jar.eachFile] or [`filesMatching`][Jar.filesMatching] to override the strategy for specific files. +- Use [`filesMatching`][Jar.filesMatching] to override the strategy for specific files. - Keep `duplicatesStrategy = INCLUDE` and write your own [`ResourceTransformer`][ResourceTransformer] to handle duplicates. If you just want to keep the current behavior and preserve the first found resources, there is a simple built-in one @@ -438,7 +438,6 @@ called [`PreserveFirstFoundResourceTransformer`][PreserveFirstFoundResourceTrans [AbstractCopyTask]: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.AbstractCopyTask.html -[Jar.eachFile]: https://docs.gradle.org/current/dsl/org.gradle.jvm.tasks.Jar.html#org.gradle.jvm.tasks.Jar:eachFile(groovy.lang.Closure) [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) [AppendingTransformer]: ../../api/shadow/com.github.jengelman.gradle.plugins.shadow.transformers/-appending-transformer/index.html [DuplicatesStrategy]: https://docs.gradle.org/current/javadoc/org/gradle/api/file/DuplicatesStrategy.html diff --git a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt index 4b7af4ea6..d5f597c00 100644 --- a/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt +++ b/src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ServiceFileTransformerTest.kt @@ -225,28 +225,7 @@ class ServiceFileTransformerTest : BaseTransformerTest() { } @Test - fun strategyExcludeCanBeOverriddenByEachFile() { - writeDuplicatesStrategy(DuplicatesStrategy.EXCLUDE) - projectScriptPath.appendText( - """ - $shadowJar { - eachFile { - duplicatesStrategy = DuplicatesStrategy.INCLUDE - } - } - """.trimIndent(), - ) - - run(shadowJarTask) - - assertThat(outputShadowJar).useAll { - getContent(ENTRY_SERVICES_SHADE).isEqualTo(CONTENT_ONE_TWO) - getContent(ENTRY_SERVICES_FOO).isEqualTo("one\ntwo") - } - } - - @Test - fun strategyExcludeCanBeOverriddenByFileMatching() { + fun strategyExcludeCanBeOverriddenByFilesMatching() { writeDuplicatesStrategy(DuplicatesStrategy.EXCLUDE) projectScriptPath.appendText( """ diff --git a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt index 0dfd6dc93..386a08e9f 100644 --- a/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt +++ b/src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt @@ -196,7 +196,7 @@ public abstract class ShadowJar : Jar() { /** * Returns the strategy to use when trying to copy more than one file to the same destination. * - * This strategy can be overridden for individual files by using [eachFile] or [filesMatching]. + * This strategy can be overridden for individual files by using [filesMatching]. * * The default value is [INCLUDE]. Different strategies will lead to different results for * `foo/bar` files in the JARs to be merged: @@ -212,13 +212,12 @@ public abstract class ShadowJar : Jar() { * [EXCLUDE], as the service files are excluded beforehand. Want [ResourceTransformer]s and the strategy to work * together? There are several ways to do it: * - * - Use [eachFile] or [filesMatching] to override the strategy for specific files. + * - Use [filesMatching] to override the strategy for specific files. * - Keep `duplicatesStrategy = INCLUDE` and write your own [ResourceTransformer] to handle duplicates. * * If you just want to keep the current behavior and preserve the first found resources, there is a simple built-in one * called [PreserveFirstFoundResourceTransformer]. * - * @see [eachFile] * @see [filesMatching] * @see [DuplicatesStrategy] * @see [CopySpec.duplicatesStrategy]