Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Keep line number information, useful for stack traces. | |
|
Yaron
2016/07/18 13:41:21
put this in base/android?
smaier
2016/07/18 17:28:50
Done.
| |
| 2 -keepattributes SourceFile,LineNumberTable | |
| 3 | |
| 4 # Keep all runtime visible annotations | |
| 5 -keepattributes RuntimeVisibleAnnotations | |
| 6 | |
| 7 # Keep the annotations, because if we don't, the ProGuard rules that use them | |
| 8 # will not be respected. These classes then show up in our final dex, which we | |
| 9 # do not want - see crbug.com/628226. | |
| 10 -keep @interface android.webkit.JavascriptInterface | |
| 11 -keep @interface org.chromium.base.annotations.AccessedByNative | |
| 12 -keep @interface org.chromium.base.annotations.CalledByNative | |
| 13 -keep @interface org.chromium.base.annotations.CalledByNativeUnchecked | |
| 14 -keep @interface org.chromium.base.annotations.RemovableInRelease | |
| 15 -keep @interface org.chromium.base.annotations.UsedByReflection | |
| 16 | |
| 17 # Keeps for class level annotations. | |
| 18 -keep @org.chromium.base.annotations.UsedByReflection class * | |
| 19 | |
| 20 # Keeps for method level annotations. | |
| 21 -keepclasseswithmembers class * { | |
| 22 @android.webkit.JavascriptInterface <methods>; | |
| 23 } | |
| 24 -keepclasseswithmembers class * { | |
| 25 @org.chromium.base.annotations.AccessedByNative <fields>; | |
| 26 } | |
| 27 -keepclasseswithmembers,includedescriptorclasses class * { | |
| 28 @org.chromium.base.annotations.CalledByNative <methods>; | |
| 29 } | |
| 30 -keepclasseswithmembers,includedescriptorclasses class * { | |
| 31 @org.chromium.base.annotations.CalledByNativeUnchecked <methods>; | |
| 32 } | |
| 33 -keepclasseswithmembers class * { | |
| 34 @org.chromium.base.annotations.UsedByReflection <methods>; | |
| 35 } | |
| 36 -keepclasseswithmembers,includedescriptorclasses class org.chromium.** { | |
| 37 native <methods>; | |
| 38 } | |
| 39 | |
| 40 # Remove methods annotated with this if their return value is unused | |
| 41 -assumenosideeffects class * { | |
| 42 @org.chromium.base.annotations.RemovableInRelease <methods>; | |
| 43 } | |
| 44 | |
| 45 # Allows Proguard freedom in removing these log related calls. We ask for debug | |
| 46 # and verbose logs to be stripped out in base.Log, so we are just ensuring we | |
| 47 # get rid of all other debug/verbose logs. | |
| 48 -assumenosideeffects class android.util.Log { | |
| 49 static *** d(...); | |
| 50 static *** v(...); | |
| 51 static *** isLoggable(...); | |
| 52 } | |
| 53 | |
| 54 # Class merging provides negligible .dex size reduction and method count | |
| 55 # reduction (about 0.3% improvement on method count, and 0.1% savings on size), | |
| 56 # and it messes up stack traces if the classes are optimized. Thus, it is in our | |
| 57 # best interests to turn it off. See crbug.com/620323 | |
| 58 -optimizations !class/merging/* | |
| 59 | |
| 60 # Allowing Proguard to change modifiers. This change shrinks the .dex size by | |
| 61 # ~1.1%, and reduces the method count by ~4.3%. | |
| 62 -allowaccessmodification | |
| 63 | |
| 64 # Keep all enum values and valueOf methods. See | |
| 65 # http://proguard.sourceforge.net/index.html#manual/examples.html | |
| 66 # for the reason for this. Also, see http://crbug.com/248037. | |
| 67 -keepclassmembers enum * { | |
| 68 public static **[] values(); | |
| 69 public static ** valueOf(java.lang.String); | |
| 70 } | |
| OLD | NEW |