Add global rule for -keepattributes Exceptions

R8 full mode requires an explicit keep rule for keeping attributes for a
given target (class/method/member). As such, we can set the global rule
for keeping these attributes with minimal cost while reducing the
maintenance burden for adding incremental keep rules.

For a typical Android build, this adds <20KB total to the image.

Bug: 215530220
Test: m
Change-Id: Iad3de32e27da0ca93b618d8a203ee65bae0bb5d1
This commit is contained in:
Jared Duke 2023-08-14 21:09:50 +00:00
parent 82d233a1bd
commit 3f2741215f

View file

@ -10,6 +10,12 @@
# and RuntimeVisibleTypeAnnotations, as well as associated defaults. # and RuntimeVisibleTypeAnnotations, as well as associated defaults.
-keepattributes RuntimeVisible*Annotation*,AnnotationDefault -keepattributes RuntimeVisible*Annotation*,AnnotationDefault
# With R8 full mode, certain attributes are only kept when matched with an
# explicit keep rule for that target, even with a global -keepattributes rule.
# As such, we can add the global keep rule here with minimal cost while
# simplifying incremental development.
-keepattributes Exceptions
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * { -keepclassmembers enum * {
public static **[] values(); public static **[] values();