Skip to content

Commit 3584b84

Browse files
committed
Relocate extensionClasses and staticExtensionClasses
1 parent 63185d7 commit 3584b84

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/GroovyExtensionModuleTransformer.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.github.jengelman.gradle.plugins.shadow.transformers
22

33
import com.github.jengelman.gradle.plugins.shadow.internal.inputStream
44
import com.github.jengelman.gradle.plugins.shadow.internal.zipEntry
5+
import com.github.jengelman.gradle.plugins.shadow.relocation.relocateClass
56
import java.util.Properties
67
import org.apache.tools.zip.ZipOutputStream
78
import org.gradle.api.file.FileTreeElement
@@ -46,8 +47,19 @@ public open class GroovyExtensionModuleTransformer : ResourceTransformer {
4647
}
4748
KEY_EXTENSION_CLASSES,
4849
KEY_STATIC_EXTENSION_CLASSES,
49-
-> handle(key, value as String) { existingValue ->
50-
module.setProperty(key, "$existingValue,$value")
50+
-> {
51+
val relocatedValue = (value as String).split(',').joinToString(",") { className ->
52+
var relocatedClass = className
53+
context.relocators.forEach { relocator ->
54+
if (relocator.canRelocateClass(relocatedClass)) {
55+
relocatedClass = relocator.relocateClass(relocatedClass)
56+
}
57+
}
58+
relocatedClass
59+
}
60+
handle(key, relocatedValue) { existingValue ->
61+
module.setProperty(key, "$existingValue,$relocatedValue")
62+
}
5163
}
5264
}
5365
}

0 commit comments

Comments
 (0)