From 3f2741215f0b34884cb486757f8280a21b875023 Mon Sep 17 00:00:00 2001 From: Jared Duke Date: Mon, 14 Aug 2023 21:09:50 +0000 Subject: [PATCH] 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 --- core/proguard_basic_keeps.flags | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/proguard_basic_keeps.flags b/core/proguard_basic_keeps.flags index b59527a8cd..f6b34b8217 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();