Skip to content
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

Additional files (README and CHANGES) published in META-INF #1666

Closed
anthonymonori opened this issue Nov 4, 2021 · 4 comments
Closed

Additional files (README and CHANGES) published in META-INF #1666

anthonymonori opened this issue Nov 4, 2021 · 4 comments

Comments

@anthonymonori
Copy link

While this can always be filtered out in the consumer side, I find it unnecessary that jsoup ends up putting the README.md and CHANGES in the META-INF folder, resulting in additional 17.4 KB (aprox) extra space.

https://github.com/jhy/jsoup/blob/master/pom.xml#L233-L234

Is there any specific reason why is this being done on purpose? LICENSE file I may understand (although I don't seem to get that -- probably something our android build tools filters out), but not the other two.

Would you consider removing those? Or you see it as something to be done by the users of the library in their use cases?

@jhy
Copy link
Owner

jhy commented Nov 5, 2021

The jar is the canonical published artifact. Yes, I want those files there.

@jhy jhy closed this as completed Nov 5, 2021
@mateuszkwiecinski
Copy link

I just stumbled upon the same issue when realized my APKs also contains these files 👀
They take ~24kb now :/
image

Would it be possible to somehow improve the experience for Android devs? Can this library publish some additional Proguard/R8 rules, so it gets automatically optimized when shrinking an apk with R8?

And out of curiosity: what's the purpose of these files? Are there any tools that read jar content and parse it later? Isn't LICENSE information already included in pom file?

@anthonymonori
Copy link
Author

Hey @mateuszkwiecinski

For now, you can exclude them yourself during packaging of the aab/apk by adding the following to your app's build.gradle.kts (or equivalent in Groovy)

android {
    //...
    packagingOptions {
        resources {
            excludes.addAll(listOf("META-INF/README.md", "META-INF/CHANGES")) // https://github.com/jhy/jsoup/issues/1666
        }
    }
}

@mateuszkwiecinski
Copy link

Thanks. That's what I did actually :)
Although, my concern was it's not obvious every Android project, using this great library, should have such configuration added. So I started wondering if it could be improved. Maybe there is a way to publish R8/Proguard configuration in a way this resources could be removed while shrinking?

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

No branches or pull requests

3 participants