Commit 6eff9fcd authored by smaier's avatar smaier Committed by Commit bot

Fixing WebView ProGuard config for annotations

WebView used to not -keep its annotations. Thus, when trying to do
anything useful with ProGuard, it appeared that the annotations were not
being obeyed, since ProGuard had already stripped them out.

Note - since we still have the -keepnames class *** { *; }, this effectively
prevents any real optimizations from being run.

This change brings the .dex size down 7356 B, and removes 12 types, 5 fields,
and 57 strings. However, these all seem inconsequential, as this is the
method/class diff of this change:

org.chromium.base.Log
-  void d(java.lang.String,java.lang.String,java.lang.Object)
-  void v(java.lang.String,java.lang.String)
-  void d(java.lang.String,java.lang.String,java.lang.Object,java.lang.Object,java.lang.Object)
-  java.lang.String formatLogWithStack(java.lang.String,java.lang.Object[])
-  void d(java.lang.String,java.lang.String)
-  void v(java.lang.String,java.lang.String,java.lang.Object,java.lang.Object,java.lang.Object)
-  void <init>()
-  void d(java.lang.String,java.lang.String,java.lang.Object,java.lang.Object)
-  java.lang.String getCallOrigin()
-  void debug(java.lang.String,java.lang.String,java.lang.Object[])
-  void verbose(java.lang.String,java.lang.String,java.lang.Object[])

BUG=541543,583143,624827,627139

Review-Url: https://codereview.chromium.org/2147743002
Cr-Commit-Position: refs/heads/master@{#405491}
parent 7827029d
...@@ -8,10 +8,14 @@ ...@@ -8,10 +8,14 @@
# Keep all runtime visible annotations. # Keep all runtime visible annotations.
-keepattributes RuntimeVisibleAnnotations -keepattributes RuntimeVisibleAnnotations
# Keeping annotations - if we remove these keeps, ProGuard will eliminate the
# Disable optimization as this causes proguard to remove seemingly random stuff, # annotations themselves, which will prevent them from affecting ProGuard's
# including things explicitly kept in this configuration. # optimization run.
-dontoptimize -keep @interface **.AccessedByNative
-keep @interface **.CalledByNative
-keep @interface **.CalledByNativeUnchecked
-keep @interface **.RemovableInRelease
-keep @interface **.UsedByReflection
# Keep the factory and its public members; it's the main entry point used by the # Keep the factory and its public members; it's the main entry point used by the
# framework. # framework.
...@@ -39,11 +43,19 @@ ...@@ -39,11 +43,19 @@
native <methods>; native <methods>;
} }
# Keep things explicitly marked as used by reflection # Keep classes marked as used by reflection
-keep @**.UsedByReflection class com.android.webview.chromium.**,org.chromium.**
# Keep members explicitly marked as used by reflection
-keepclasseswithmembers class com.android.webview.chromium.**,org.chromium.** { -keepclasseswithmembers class com.android.webview.chromium.**,org.chromium.** {
@**.UsedByReflection *; @**.UsedByReflection *;
} }
# Remove methods annotated with this if their return value is unused
-assumenosideeffects class ** {
@org.chromium.base.annotations.RemovableInRelease <methods>;
}
# Linker dynamically casts to $TestRunner when running tests. We don't run these # Linker dynamically casts to $TestRunner when running tests. We don't run these
# tests in WebView. # tests in WebView.
-dontnote org.chromium.base.library_loader.Linker$TestRunner -dontnote org.chromium.base.library_loader.Linker$TestRunner
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment