-
Notifications
You must be signed in to change notification settings - Fork 7
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
How can I merge resource files such as service files and MANIFEST? #20
Comments
Woops sorry I managed to miss that issue completely.
Edit: it won't merge if several implementations implement the same interface. For MANIFEST, I'm not sure, what do you want to merge? |
The attributes in |
I don't think R8 has support for that. You could file a feature request at https://issuetracker.google.com/u/1/issues/new?component=192708&template=840533 but my hunch is that such a feature would require some logic: if 2 attributes conflict, what should be the result? I'm not sure that belongs in R8 or Gr8. You could do a post-processing task for an example to replace the Manifest in the minified jar. Out of curiosity, what's the use case? What attributes do you need merged? |
Mainly the Custom transformer/merge is required The workaround I'm using in shadow GradleUp/shadow#278 (comment) |
I see, thanks for providing this. Shadow supports Doing the same without writing a 2nd jar in Gr8 would require R8 to accept a callback to modify the jar content on the fly, which is currently not possible. You can still achieve the same though with a custom task that takes the shadowed jar and rewrites the manifest. Something like so (wildly untested): val shadowedJar = create("default") {
// ...
}
val rewriteManifest = tasks.register("rewriteManifest", Jar::class.java) {
from(shadowedJar)
manifest {
from(
configurations
.flatMap { it.files }
.map { zipTree(it) }
.map { zip -> zip.find { it.name.equals("MANIFEST.MF") } }
)
}
} |
No description provided.
The text was updated successfully, but these errors were encountered: