beryx / badass-jlink-plugin

Create a custom runtime image of your modular application
https://badass-jlink-plugin.beryx.org
Apache License 2.0
385 stars 27 forks source link

Duplicate data in packages produced by jpackage #51

Closed nemphys closed 4 years ago

nemphys commented 5 years ago

I tried making a macOs .app using the jpackage functionality for the first time and, although all went well and the app works as expected, the total size of the app directory is 1.5x the size it should be (the jlink task produces a total size of ~100MB in my case, whereas the .app is ~150MB). After checking the contents of the .app I noticed something weird: apart from the Plugins/Java.runtime directory (which seems to include all of the jlink task results), there is a Java/mods directory, which includes separate jar files + the merged module file. If I understand correctly, all these jars are already merged inside the "modules" file residing in the libs directory (Plugins/Java.runtime/contents/home/lib) of the runtime image produced by jlink. Although I prefer to have separate jars than the huge uber-merged modules file produced by jlink (this is another discussion, I would love to have some more info on this and whether it is optional), there seems to be some kind of duplication here. Any thoughts would be appreciated.

EDIT: I just deleted the Java/mods directory from the produced .app and the app still launches and works fine. This verifies that the directory is unneeded and I am wondering why it is being produced. I suspect it is a jpackage thing and the badass plugin has nothing to do with it.

siordache commented 5 years ago

Yes, it looks like a jpackage thing.

msgilligan commented 5 years ago

Should we report this issue to jpackage?

DJViking commented 5 years ago

If this is still an issue we should report it to jpackage on core-libs-dev@openjdk.java.net Have you tried with the latest JDK-14 jpackage build if this is still a problem? https://jdk.java.net/jpackage

I cannot see that this is a reported bug with jpackage: https://bugs.openjdk.java.net/issues/?jql=project+in+%28JDK%29+AND+component+in+%28tools%29+AND+Subcomponent+in+%28jpackage%29

tobiasdiez commented 4 years ago

The two issues https://bugs.openjdk.java.net/browse/JDK-8236830 and https://bugs.openjdk.java.net/browse/JDK-8249011 were closed with the argument that this folder is only included if jpackage is invoked with the wrong arguments, i.e. jpackage includes everything that is in the folder passed as --input. So I guess the problem does lie in this gradle plugin and how it invokes jpackage.

siordache commented 4 years ago

Please check and report if duplicate data is still produced when using org.beryx.jlink 2.21.1.

tobiasdiez commented 4 years ago

Thanks a lot! It worked for us and reduced the installer size by almost 50%.

nemphys commented 4 years ago

Indeed, it seems that the issue is now resolved. Thank you.

siordache commented 4 years ago

Great! Thank you both for the feedback.

msgilligan commented 4 years ago

Thanks for this. It's saves about 9-10 Mb (after compression) in a trivial app: Before:

BA_JLink_2_21_0 After:

BA_JLink_2_21_1