mobile/android/config/proguard.cfg

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/config/proguard.cfg	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,201 @@
     1.4 +# Dalvik renders preverification unuseful (Would just slightly bloat the file).
     1.5 +-dontpreverify
     1.6 +
     1.7 +# Uncomment to have Proguard list dead code detected during the run - useful for cleaning up the codebase.
     1.8 +# -printusage
     1.9 +
    1.10 +-dontskipnonpubliclibraryclassmembers
    1.11 +-verbose
    1.12 +-allowaccessmodification
    1.13 +
    1.14 +# Preserve all fundamental application classes.
    1.15 +-keep public class * extends android.app.Activity
    1.16 +-keep public class * extends android.app.Application
    1.17 +-keep public class * extends android.app.Service
    1.18 +-keep public class * extends android.app.backup.BackupAgentHelper
    1.19 +-keep public class * extends android.content.BroadcastReceiver
    1.20 +-keep public class * extends android.content.ContentProvider
    1.21 +-keep public class * extends android.preference.Preference
    1.22 +-keep public class * extends org.mozilla.gecko.sync.syncadapter.SyncAdapter
    1.23 +-keep class org.mozilla.gecko.sync.syncadapter.SyncAdapter
    1.24 +
    1.25 +# Preserve all native method names and the names of their classes.
    1.26 +-keepclasseswithmembernames class * {
    1.27 +    native <methods>;
    1.28 +}
    1.29 +
    1.30 +-keepclasseswithmembers class * {
    1.31 +    public <init>(android.content.Context, android.util.AttributeSet, int);
    1.32 +}
    1.33 +
    1.34 +-keepclassmembers class * extends android.app.Activity {
    1.35 +   public void *(android.view.View);
    1.36 +}
    1.37 +
    1.38 +# Preserve enums. (For awful reasons, the runtime accesses them using introspection...)
    1.39 +-keepclassmembers enum * {
    1.40 +     *;
    1.41 +}
    1.42 +
    1.43 +#
    1.44 +# Rules from ProGuard's Android example:
    1.45 +# http://proguard.sourceforge.net/manual/examples.html#androidapplication
    1.46 +#
    1.47 +
    1.48 +# Switch off some optimizations that trip older versions of the Dalvik VM.
    1.49 +
    1.50 +-optimizations !code/simplification/arithmetic
    1.51 +
    1.52 +# Keep a fixed source file attribute and all line number tables to get line
    1.53 +# numbers in the stack traces.
    1.54 +# You can comment this out if you're not interested in stack traces.
    1.55 +
    1.56 +-renamesourcefileattribute SourceFile
    1.57 +-keepattributes SourceFile,LineNumberTable
    1.58 +
    1.59 +# RemoteViews might need annotations.
    1.60 +
    1.61 +-keepattributes *Annotation*
    1.62 +
    1.63 +# Preserve all View implementations, their special context constructors, and
    1.64 +# their setters.
    1.65 +
    1.66 +-keep public class * extends android.view.View {
    1.67 +    public <init>(android.content.Context);
    1.68 +    public <init>(android.content.Context, android.util.AttributeSet);
    1.69 +    public <init>(android.content.Context, android.util.AttributeSet, int);
    1.70 +    public void set*(...);
    1.71 +}
    1.72 +
    1.73 +# Preserve all classes that have special context constructors, and the
    1.74 +# constructors themselves.
    1.75 +
    1.76 +-keepclasseswithmembers class * {
    1.77 +    public <init>(android.content.Context, android.util.AttributeSet);
    1.78 +}
    1.79 +
    1.80 +# Preserve the special fields of all Parcelable implementations.
    1.81 +
    1.82 +-keepclassmembers class * implements android.os.Parcelable {
    1.83 +    static android.os.Parcelable$Creator CREATOR;
    1.84 +}
    1.85 +
    1.86 +# Preserve static fields of inner classes of R classes that might be accessed
    1.87 +# through introspection.
    1.88 +
    1.89 +-keepclassmembers class **.R$* {
    1.90 +  public static <fields>;
    1.91 +}
    1.92 +
    1.93 +# Preserve the required interface from the License Verification Library
    1.94 +# (but don't nag the developer if the library is not used at all).
    1.95 +
    1.96 +-keep public interface com.android.vending.licensing.ILicensingService
    1.97 +
    1.98 +-dontnote com.android.vending.licensing.ILicensingService
    1.99 +
   1.100 +# The Android Compatibility library references some classes that may not be
   1.101 +# present in all versions of the API, but we know that's ok.
   1.102 +
   1.103 +-dontwarn android.support.**
   1.104 +
   1.105 +# Preserve all native method names and the names of their classes.
   1.106 +
   1.107 +-keepclasseswithmembernames class * {
   1.108 +    native <methods>;
   1.109 +}
   1.110 +
   1.111 +#
   1.112 +# Mozilla-specific rules
   1.113 +#
   1.114 +# Merging classes can generate dex warnings about anonymous inner classes.
   1.115 +-optimizations !class/merging/horizontal
   1.116 +-optimizations !class/merging/vertical
   1.117 +
   1.118 +# Keep miscellaneous targets.
   1.119 +
   1.120 +# Keep the annotation.
   1.121 +-keep @interface org.mozilla.gecko.mozglue.JNITarget
   1.122 +
   1.123 +# Keep classes tagged with the annotation.
   1.124 +-keep @org.mozilla.gecko.mozglue.JNITarget class *
   1.125 +
   1.126 +# Keep all members of an annotated class.
   1.127 +-keepclassmembers @org.mozilla.gecko.mozglue.JNITarget class * {
   1.128 +    *;
   1.129 +}
   1.130 +
   1.131 +# Keep annotated members of any class.
   1.132 +-keepclassmembers class * {
   1.133 +    @org.mozilla.gecko.mozglue.JNITarget *;
   1.134 +}
   1.135 +
   1.136 +# Keep classes which contain at least one annotated element. Split over two directives
   1.137 +# because, according to the developer of ProGuard, "the option -keepclasseswithmembers
   1.138 +# doesn't combine well with the '*' wildcard" (And, indeed, using it causes things to
   1.139 +# be deleted that we want to keep.)
   1.140 +-keepclasseswithmembers class * {
   1.141 +    @org.mozilla.gecko.mozglue.JNITarget <methods>;
   1.142 +}
   1.143 +-keepclasseswithmembers class * {
   1.144 +    @org.mozilla.gecko.mozglue.JNITarget <fields>;
   1.145 +}
   1.146 +
   1.147 +# Keep Robocop targets. TODO: Can omit these from release builds. Also, Bug 916507.
   1.148 +
   1.149 +# Same formula as above...
   1.150 +-keep @interface org.mozilla.gecko.mozglue.RobocopTarget
   1.151 +-keep @org.mozilla.gecko.mozglue.RobocopTarget class *
   1.152 +-keepclassmembers class * {
   1.153 +    @org.mozilla.gecko.mozglue.RobocopTarget *;
   1.154 +}
   1.155 +-keepclassmembers @org.mozilla.gecko.mozglue.RobocopTarget class * {
   1.156 +    *;
   1.157 +}
   1.158 +-keepclasseswithmembers class * {
   1.159 +    @org.mozilla.gecko.mozglue.RobocopTarget <methods>;
   1.160 +}
   1.161 +-keepclasseswithmembers class * {
   1.162 +    @org.mozilla.gecko.mozglue.RobocopTarget <fields>;
   1.163 +}
   1.164 +
   1.165 +# Keep WebRTC targets.
   1.166 +-keep @interface org.mozilla.gecko.mozglue.WebRTCJNITarget
   1.167 +-keep @org.mozilla.gecko.mozglue.WebRTCJNITarget class *
   1.168 +-keepclassmembers class * {
   1.169 +    @org.mozilla.gecko.mozglue.WebRTCJNITarget *;
   1.170 +}
   1.171 +-keepclassmembers @org.mozilla.gecko.mozglue.WebRTCJNITarget class * {
   1.172 +    *;
   1.173 +}
   1.174 +-keepclasseswithmembers class * {
   1.175 +    @org.mozilla.gecko.mozglue.WebRTCJNITarget <methods>;
   1.176 +}
   1.177 +-keepclasseswithmembers class * {
   1.178 +    @org.mozilla.gecko.mozglue.WebRTCJNITarget <fields>;
   1.179 +}
   1.180 +
   1.181 +# Keep generator-targeted entry points.
   1.182 +-keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI
   1.183 +-keep @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI class *
   1.184 +-keepclassmembers class * {
   1.185 +    @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI *;
   1.186 +}
   1.187 +-keepclasseswithmembers class * {
   1.188 +    @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI <methods>;
   1.189 +}
   1.190 +-keepclasseswithmembers class * {
   1.191 +    @org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI <fields>;
   1.192 +}
   1.193 +
   1.194 +-keep @interface org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI
   1.195 +-keep @org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI class *
   1.196 +-keepclassmembers @org.mozilla.gecko.mozglue.generatorannotations.WrapEntireClassForJNI class * {
   1.197 +    *;
   1.198 +}
   1.199 +
   1.200 +# Disable obfuscation because it makes exception stack traces more difficult to read.
   1.201 +-dontobfuscate
   1.202 +
   1.203 +# Suppress warnings about missing descriptor classes.
   1.204 +#-dontnote **,!ch.boye.**,!org.mozilla.gecko.sync.**

mercurial