platform_build/core/proguard.flags
Jared Duke 4bd749bf38 Generalize @Keep annotation Proguard rules
Consolidate the Proguard rules for @Keep annotations for:
  * android.support.annotation.Keep (existing)
  * androidx.annotation.Keep (existing)
  * com.android.internal.annotation.Keep (new)

This ensures consistent semantics for clients using these annotations
across the codebase. Ideally there would be a single annotation, but
the support libraries are not available everywhere. In practice, this
change should be a no-op.

Bug: 210510433
Test: m + validate identical artifact sizes
Change-Id: Iab494e03269e5758d7f860331e971826ecc08cdd
2022-01-21 19:50:15 +00:00

38 lines
1 KiB
Text

# We have moved -dontobfuscate and -dontoptimize to the makefiles.
# dex does not like code run through proguard optimize and preverify steps.
# -dontoptimize
-dontpreverify
# Don't obfuscate. We only need dead code striping.
# -dontobfuscate
# Add this flag in your package's own configuration if it's needed.
#-flattenpackagehierarchy
# Keep classes and methods that have the guava @VisibleForTesting annotation
-keep @**.VisibleForTesting class *
-keepclassmembers class * {
@**.VisibleForTesting *;
}
# Understand the common @Keep annotation from various Android packages:
# * android.support.annotation
# * androidx.annotation
# * com.android.internal.annotations
-keep class **android**.annotation*.Keep
-keep @**android**.annotation*.Keep class * { *; }
-keepclasseswithmembers class * {
@**android**.annotation*.Keep <methods>;
}
-keepclasseswithmembers class * {
@**android**.annotation*.Keep <fields>;
}
-keepclasseswithmembers class * {
@**android**.annotation*.Keep <init>(...);
}
-include proguard_basic_keeps.flags