From 9200ca4449fbcbc9b789e3b49c441dac27f13c83 Mon Sep 17 00:00:00 2001 From: Goooler Date: Wed, 10 Dec 2025 23:29:20 +0800 Subject: [PATCH 1/3] Add Kdoc for applying resource transformers --- .../gradle/plugins/shadow/tasks/ShadowJar.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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 8171b817c..c3ec6b892 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 @@ -279,6 +279,11 @@ public abstract class ShadowJar : Jar() { /** * Merge Java services files with [rootPath]. + * + * *Warning*: In most cases, this should be used with the correct [getDuplicatesStrategy] to ensure duplicate service + * files are handled properly. + * + * @see [getDuplicatesStrategy] */ public open fun mergeServiceFiles(rootPath: String) { mergeServiceFiles { it.path = rootPath } @@ -286,6 +291,11 @@ public abstract class ShadowJar : Jar() { /** * Merge Java services files with [action]. + * + * *Warning*: In most cases, this should be used with the correct [getDuplicatesStrategy] to ensure duplicate service + * files are handled properly. + * + * @see [getDuplicatesStrategy] */ @JvmOverloads public open fun mergeServiceFiles(action: Action = Action {}) { @@ -294,6 +304,11 @@ public abstract class ShadowJar : Jar() { /** * Merge Groovy extension modules (`META-INF/**/org.codehaus.groovy.runtime.ExtensionModule`). + * + * *Warning*: In most cases, this should be used with the correct [getDuplicatesStrategy] to ensure duplicate service + * files are handled properly. + * + * @see [getDuplicatesStrategy] */ public open fun mergeGroovyExtensionModules() { transform(GroovyExtensionModuleTransformer::class.java, action = {}) @@ -355,6 +370,11 @@ public abstract class ShadowJar : Jar() { /** * Transform resources using a [ResourceTransformer]. + * + * *Warning*: Most of the [ResourceTransformer]s should be used with the correct [getDuplicatesStrategy] to ensure + * duplicate resource files are handled properly. + * + * @see [getDuplicatesStrategy] */ @JvmOverloads public open fun transform(clazz: Class, action: Action = Action {}) { @@ -363,6 +383,11 @@ public abstract class ShadowJar : Jar() { /** * Transform resources using a [ResourceTransformer]. + * + * *Warning*: Most of the [ResourceTransformer]s should be used with the correct [getDuplicatesStrategy] to ensure + * duplicate resource files are handled properly. + * + * @see [getDuplicatesStrategy] */ @JvmOverloads public open fun transform(transformer: T, action: Action = Action {}) { @@ -371,6 +396,11 @@ public abstract class ShadowJar : Jar() { /** * Transform resources using a [ResourceTransformer]. + * + * *Warning*: Most of the [ResourceTransformer]s should be used with the correct [getDuplicatesStrategy] to ensure + * duplicate resource files are handled properly. + * + * @see [getDuplicatesStrategy] */ @JvmSynthetic public inline fun transform(action: Action = Action {}) { From cd831db4ee911cc4f83e0aa6880e97e847e392b5 Mon Sep 17 00:00:00 2001 From: Zongle Wang Date: Wed, 10 Dec 2025 23:37:23 +0800 Subject: [PATCH 2/3] Update src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c3ec6b892..ce4be156f 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 @@ -305,7 +305,7 @@ public abstract class ShadowJar : Jar() { /** * Merge Groovy extension modules (`META-INF/**/org.codehaus.groovy.runtime.ExtensionModule`). * - * *Warning*: In most cases, this should be used with the correct [getDuplicatesStrategy] to ensure duplicate service + * *Warning*: In most cases, this should be used with the correct [getDuplicatesStrategy] to ensure duplicate extension module * files are handled properly. * * @see [getDuplicatesStrategy] From ff512673f9ed5ea403ff5a1fa715e8fea6be1c0c Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 12 Dec 2025 11:11:32 +0800 Subject: [PATCH 3/3] Mention `Handling Duplicates Strategy` --- .../gradle/plugins/shadow/tasks/ShadowJar.kt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 470cdbe62..4977aa1d4 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 @@ -296,7 +296,8 @@ public abstract class ShadowJar : Jar() { * Merge Java services files with [rootPath]. * * *Warning*: In most cases, this should be used with the correct [getDuplicatesStrategy] to ensure duplicate service - * files are handled properly. + * files are handled properly. See more details in the + * [Handling Duplicates Strategy](https://gradleup.com/shadow/configuration/merging/#handling-duplicates-strategy) section. * * @see [getDuplicatesStrategy] */ @@ -308,7 +309,8 @@ public abstract class ShadowJar : Jar() { * Merge Java services files with [action]. * * *Warning*: In most cases, this should be used with the correct [getDuplicatesStrategy] to ensure duplicate service - * files are handled properly. + * files are handled properly. See more details in the + * [Handling Duplicates Strategy](https://gradleup.com/shadow/configuration/merging/#handling-duplicates-strategy) section. * * @see [getDuplicatesStrategy] */ @@ -321,7 +323,8 @@ public abstract class ShadowJar : Jar() { * Merge Groovy extension modules (`META-INF/**/org.codehaus.groovy.runtime.ExtensionModule`). * * *Warning*: In most cases, this should be used with the correct [getDuplicatesStrategy] to ensure duplicate extension module - * files are handled properly. + * files are handled properly. See more details in the + * [Handling Duplicates Strategy](https://gradleup.com/shadow/configuration/merging/#handling-duplicates-strategy) section. * * @see [getDuplicatesStrategy] */ @@ -387,7 +390,8 @@ public abstract class ShadowJar : Jar() { * Transform resources using a [ResourceTransformer]. * * *Warning*: Most of the [ResourceTransformer]s should be used with the correct [getDuplicatesStrategy] to ensure - * duplicate resource files are handled properly. + * duplicate resource files are handled properly. See more details in the + * [Handling Duplicates Strategy](https://gradleup.com/shadow/configuration/merging/#handling-duplicates-strategy) section. * * @see [getDuplicatesStrategy] */ @@ -400,7 +404,8 @@ public abstract class ShadowJar : Jar() { * Transform resources using a [ResourceTransformer]. * * *Warning*: Most of the [ResourceTransformer]s should be used with the correct [getDuplicatesStrategy] to ensure - * duplicate resource files are handled properly. + * duplicate resource files are handled properly. See more details in the + * [Handling Duplicates Strategy](https://gradleup.com/shadow/configuration/merging/#handling-duplicates-strategy) section. * * @see [getDuplicatesStrategy] */ @@ -413,7 +418,8 @@ public abstract class ShadowJar : Jar() { * Transform resources using a [ResourceTransformer]. * * *Warning*: Most of the [ResourceTransformer]s should be used with the correct [getDuplicatesStrategy] to ensure - * duplicate resource files are handled properly. + * duplicate resource files are handled properly. See more details in the + * [Handling Duplicates Strategy](https://gradleup.com/shadow/configuration/merging/#handling-duplicates-strategy) section. * * @see [getDuplicatesStrategy] */