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
diff --git a/core/proguard_basic_keeps.flags b/core/proguard_basic_keeps.flags
index b59527a..f6b34b8 100644
--- a/core/proguard_basic_keeps.flags
+++ b/core/proguard_basic_keeps.flags
@@ -10,6 +10,12 @@
# and RuntimeVisibleTypeAnnotations, as well as associated defaults.
-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
-keepclassmembers enum * {
public static **[] values();