frjaeger220 / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Use proguard to reduce size of Guice #264

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The current Guice library built from trunk is ~900k because JarJar only
works at the class level. It doesn't trim classes with lots of static
methods (as in Google Collections) and this leads to many unnecessary
classes getting left in. Extending JarJar to trim static methods looks
non-trivial.

Switching over to just use ProGuard is also not an option, because it
cannot seem to handle the CGLIB code properly (it ends up obfuscating
classes and members too much, which somehow breaks CGLIB).

The only reasonable option I've found is to apply ProGuard first to remove
unused static collection methods and use JarJar to repackage CGLIB, etc.

With the attached patch, the Guice jar drops to ~600k

[also attached ProGuard 4.3 beta 1 from http://proguard.sourceforge.net/]

Original issue reported on code.google.com by mccu...@gmail.com on 27 Oct 2008 at 5:24

Attachments:

GoogleCodeExporter commented 9 years ago
Please also see the Proguard configuration I contributed here:
http://groups.google.com/group/google-guice/browse_frm/thread/2087e02657825ef3

Original comment by gili.tza...@gmail.com on 27 Oct 2008 at 6:52

GoogleCodeExporter commented 9 years ago
FYI, I finally got around to patching JarJar to remove unused static methods:

   http://code.google.com/p/jarjar/issues/detail?id=22

it actually wasn't that much code in the end, and can shrink Guice to ~700k.
However, whether this patch will be accepted by JarJar is another matter :)

Original comment by mccu...@gmail.com on 1 Dec 2008 at 5:46

GoogleCodeExporter commented 9 years ago
We changed our build to include Google Collections as source rather than as 
classes and our .jar is now below 
700k.

Original comment by limpbizkit on 27 Apr 2009 at 6:21