-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Right now, protodata-fat-cli-<version>.jartakes approximately 170-180 MB. And it obviously carries a lot of redundant things with it/
In scope of this task, we should try and append the shrinking step to the CI pipeline.
The idea is to use ProGuard along with its Gradle plugin.
Here is the preliminary ProGuard ruleset with which ProGuard 7.2.2 in its standalone mode completes the shrinking process:
-injars ./protodata-fat-cli-<version>.jar
-outjars ./protodata-fat-cli-<version>-out.jar
-libraryjars <YOUR_PATH_HERE>/zulu-11.jdk/Contents/Home/jmods/java.base.jmod(!**.jar;!module-info.class):<YOUR_PATH_HERE>/zulu-11.jdk/Contents/Home/jmods/java.desktop.jmod(!**.jar;!module-info.class)
-dontoptimize
-dontwarn
-dontobfuscate
# Uncomment if you want to see ~350K of warnings.
# -verbose
-keepattributes *Annotation*
-keepattributes Signature
-keepattributes InnerClasses
-keepattributes InnerClasses,EnclosingMethod
-keep class kotlin.Metadata
-keep,includedescriptorclasses class io.spine.** { *; }
-keep,includedescriptorclasses class com.google.common.** { *; }
-keep,includedescriptorclasses class com.google.protobuf.** { *; }
(where YOUR_PATH_HERE should be changed to the corresponding value).
The resulting JAR was NOT tested. But the size was down 177 MB -> 56.8 MB.
Another room for improvement is with the static resources . There are tons of these in our JAR. And ProGuard has no means to detect whether they are used.