7b5629bcfc
* Update ProGuard default shrinking rules to correctly deal with classes without a no-args constructor * Update test after changing default shrinking rules * Adjust shrinker tests * Update rules * Addressed review comments * Addressed more review comments * Addressed more review comments --------- Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
25 lines
1.2 KiB
Prolog
25 lines
1.2 KiB
Prolog
# Include common rules
|
|
-include common.pro
|
|
|
|
### The following rules are needed for R8 in "full mode", which performs more aggressive optimizations than ProGuard
|
|
### See https://r8.googlesource.com/r8/+/refs/heads/main/compatibility-faq.md#r8-full-mode
|
|
|
|
# For classes with generic type parameter R8 in "full mode" requires to have a keep rule to
|
|
# preserve the generic signature
|
|
-keep,allowshrinking,allowoptimization,allowobfuscation,allowaccessmodification class com.example.GenericClasses$GenericClass
|
|
-keep,allowshrinking,allowoptimization,allowobfuscation,allowaccessmodification class com.example.GenericClasses$GenericUsingGenericClass
|
|
|
|
# Don't obfuscate class name, to check it in exception message
|
|
-keep,allowshrinking,allowoptimization class com.example.NoSerializedNameMain$TestClass
|
|
-keep,allowshrinking,allowoptimization class com.example.NoSerializedNameMain$TestClassWithoutDefaultConstructor
|
|
|
|
# This rule has the side-effect that R8 still removes the no-args constructor, but does not make the class abstract
|
|
-keep class com.example.NoSerializedNameMain$TestClassNotAbstract {
|
|
@com.google.gson.annotations.SerializedName <fields>;
|
|
}
|
|
|
|
# Keep enum constants which are not explicitly used in code
|
|
-keepclassmembers class com.example.EnumClass {
|
|
** SECOND;
|
|
}
|