-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test cases for SimpleRelocator
#1094
Conversation
edc49c1
to
d28a7ed
Compare
Co-authored-by: zinking <[email protected]> Co-authored-by: Zongle Wang <[email protected]>
…241208/exclude-sources // Conflicts: // src/main/groovy/com/github/jengelman/gradle/plugins/shadow/impl/RelocatorRemapper.groovy // src/main/groovy/com/github/jengelman/gradle/plugins/shadow/relocation/Relocator.groovy // src/main/groovy/com/github/jengelman/gradle/plugins/shadow/relocation/SimpleRelocator.groovy // src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowCopyAction.groovy // src/test/groovy/com/github/jengelman/gradle/plugins/shadow/relocation/SimpleRelocatorTest.groovy
0c32db0
to
80b9b77
Compare
80b9b77
to
7d85cfe
Compare
…urces // Conflicts: // src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/relocation/SimpleRelocatorTest.kt
SimpleRelocator
SimpleRelocator
SimpleRelocator
SimpleRelocator
@Goooler Sorry, but it doesn't work for me. am i doing something wrong here? build.gradle.kts
Decompiled version of the jar:
@Test
fun testRelocateSourceWithExcludes() {
// Main relocator with in-/excludes
val relocator = SimpleRelocator(
"org.apache.maven",
"com.acme.maven"
)
relocator.include("foo.bar")
relocator.include("zot.baz")
relocator.exclude("irrelevant.exclude")
relocator.exclude("org.apache.maven.exclude1")
relocator.exclude("org.apache.maven.sub.exclude2")
// Make sure not to replace variables 'io' and 'ioInput', package 'java.io'
val ioRelocator = SimpleRelocator("io", "shaded.io")
// Check corner case which was not working in PR #100
val asmRelocator = SimpleRelocator("org.objectweb.asm", "aj.org.objectweb.asm")
// Make sure not to replace 'foo' package by path-like 'shaded/foo'
val fooRelocator = SimpleRelocator(
"foo",
"shaded.foo",
excludes = listOf("foo.bar"),
)
assertThat(
fooRelocator.applyToSourceContent(
asmRelocator.applyToSourceContent(
ioRelocator.applyToSourceContent(relocator.applyToSourceContent(sourceFile)),
),
),
).isEqualTo(relocatedFile)
} this doesn't pass, i've just move include/excludes parameters to use the include/exclude methods. the reason i believe is that it calculates the sourcePackageExcludes and sourcePathExcludes on init, and when you add include/exclude after the creation of the simple relocator object it doesn't calculates that, and there is no way to create the relocator object with the include/exclude parameters as far as i know. #1098 you can check this issue to see how to reproduce it and how it looks like in the code. |
https://gradleup.com/shadow/configuration/relocation/#filtering-relocation shadow/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/RelocationSpec.groovy Lines 12 to 50 in 433329f
|
SimpleRelocator
changes from maven-shade-plugin #1076.