Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Relocate should remove empty folder after relocating. #92

Open
Geno1024 opened this issue Apr 8, 2024 · 1 comment
Open

Relocate should remove empty folder after relocating. #92

Geno1024 opened this issue Apr 8, 2024 · 1 comment

Comments

@Geno1024
Copy link

Geno1024 commented Apr 8, 2024

Please check the User Guide before submitting "how do I do 'x'?" questions!

Shadow Version

id("io.github.goooler.shadow") version "8.1.7"

Gradle Version

8.6

Expected Behavior

Avoiding X-Y problem:

X: I am working for a company, then written all code with the package name containing my company according to my company's regulations. However, in some specific scenarios, my leader tells me to hide / replace all my company name specific info. So I have to "move" all package names to other name.

Y: I want to use relocate to move all sources under specific packages (that definitely controllable by my own, and the specific package name doesn't used by any other dependencies) to other name.

Actual Behavior

All classes have been moved to the new package name, but the old package empty folder still exists in the production jar file.

Hope to remove empty folder after relocate post-processing.

Gradle Build Script(s)

tasks.withType<ShadowJar> {
    isEnableRelocation = true
    relocate("[REDACTED due to company security reason]", "com.shadow")
    archiveClassifier = "shadowed"
}

Content of Shadow JAR (jar tf <jar file> - post link to GIST if too long)

META-INF/
META-INF/MANIFEST.MF
com/
com/[REDACTED]/
com/[]/[]/
com/[]/[]/[]/
com/[]/[]/[]/[]/
com/[]/[]/[]/[]/library/
com/shadow/library/[].class
com/shadow/library/[].class
com/shadow/library/[].class
com/shadow/library/[].class
com/shadow/library/[].class
com/[]/[]/[]/[]/library/level1/
com/[]/[]/[]/[]/library/level1/level2/
com/shadow/library/level1/level2/[].class
com/shadow/library/level1/level2/[].class
[et cetera]

@Geno1024
Copy link
Author

Geno1024 commented Apr 8, 2024

Possible duplicate of GradleUp#53 and GradleUp#57.

Though I am providing a MCVE, but I will provide one if you need.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant