[MediaWiki-commits] [Gerrit] Enable basic ProGuard minification - change (apps...wikipedia)

2014-12-12 Thread Dbrant (Code Review)
Dbrant has submitted this change and it was merged.

Change subject: Enable basic ProGuard minification
..


Enable basic ProGuard minification

We can make the ProGuard config more aggressive later.
Want to keep it on the lighter side initially.
This is mainly driven by the desire to fix the bugs mentioned below.

Bug: T78197
Bug: T76279
Change-Id: Ic91e83e6dc4d25780dc8815318aba2e2a0c009fb
---
M README.mediawiki
M wikipedia/build.gradle
M wikipedia/proguard-rules.pro
3 files changed, 74 insertions(+), 1 deletion(-)

Approvals:
  Dbrant: Looks good to me, approved



diff --git a/README.mediawiki b/README.mediawiki
index 260bebc..e6c3210 100644
--- a/README.mediawiki
+++ b/README.mediawiki
@@ -195,6 +195,9 @@
 To install build on device/emulator:
  ./gradlew -q installDevDebug
 
+To see ProGuard output:
+./gradlew clean --info proguardDevRelease
+
 To run tests:
  ./gradlew wikipedia:connectedAndroidTestDevDebug
 This might take some time.
diff --git a/wikipedia/build.gradle b/wikipedia/build.gradle
index a4f3329..90f2360 100644
--- a/wikipedia/build.gradle
+++ b/wikipedia/build.gradle
@@ -17,7 +17,7 @@
 }
 buildTypes {
 release {
-minifyEnabled false
+minifyEnabled true
 proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
 signingConfig signingConfigs.release
 }
diff --git a/wikipedia/proguard-rules.pro b/wikipedia/proguard-rules.pro
index 200fdff..b0e4737 100644
--- a/wikipedia/proguard-rules.pro
+++ b/wikipedia/proguard-rules.pro
@@ -15,3 +15,73 @@
 #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
 #   public *;
 #}
+
+###
+# from https://github.com/ACRA/acra/wiki/ProGuard
+#ACRA specifics
+# Restore some Source file names and restore approximate line numbers in the 
stack traces,
+# otherwise the stack traces are pretty useless
+-keepattributes SourceFile,LineNumberTable
+
+# ACRA needs annotations so add this...
+# Note: This may already be defined in the default 
proguard-android-optimize.txt
+# file in the SDK. If it is, then you don't need to duplicate it. See your
+# project.properties file to get the path to the default 
proguard-android-optimize.txt.
+-keepattributes *Annotation*
+
+-keepattributes Signature
+
+## instead of the remaining ACRA proguard config: just keep all classes for now
+-keep class org.acra.** {*;}
+
+###
+# Other libraries:
+
+# https://github.com/square/okio/issues/60
+-dontwarn okio.**
+
+-dontwarn com.squareup.okhttp.**
+-dontnote com.squareup.okhttp.internal.Platform
+
+-keep class com.nineoldandroids.animation.** {*;}
+-keep class com.nineoldandroids.util.Property {*;}
+
+-keep class com.mobsandgeeks.saripaar.** {*;}
+
+-keep class com.squareup.picasso.** {*;}
+
+-keep class uk.co.senab.photoview.** {*;}
+
+-keep class com.github.kevinsawicki.http.** {*;}
+
+###
+# Android support libraries:
+
+# https://phabricator.wikimedia.org/T78197:
+# NoClassDefFoundError: android.support.v7.internal.view.menu.MenuBuilder
+# 
http://stackoverflow.com/questions/26657348/appcompat-v7-v21-0-0-causing-crash-on-samsung-devices-with-android-v4-2-2
+# Allow obfuscation of android.support.v7.internal.view.menu.** but not the 
rest of android.support
+# to avoid problem on Samsung 4.2.2 devices with appcompat v21
+# see https://code.google.com/p/android/issues/detail?id=78377#hc150
+-keep class !android.support.v7.internal.view.menu.MenuBuilder
+-keep class !android.support.v7.internal.view.menu.SubMenuBuilder
+
+# Make sure we keep android.support.v4.widget.DrawerLayout and friends
+# because we're using reflection.
+# Thus, the annoying feature of the nav and ToC drawers peeking in still works.
+# This works but not sure what our other libraries do in terms of reflection 
with support-v4:
+#-keep class android.support.v4.widget.DrawerLayout {*;}
+#-keep class android.support.v4.widget.FixedDrawerLayout {*;}
+#-keep class android.support.v4.widget.ViewDragHelper {*;}
+
+# For now just keep all of v4, just to be on the safe side
+-keep class android.support.v4.** {*;}
+
+-dontnote android.support.v4.text.ICUCompatIcs
+
+#-dontwarn android.support.**
+
+###
+# Our code:
+-keep class org.wikipedia.** {*;}
+-keep class org.mediawiki.api.json.** {*;}

-- 
To view, visit https://gerrit.wikimedia.org/r/179174
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic91e83e6dc4d25780dc8815318aba2e2a0c009fb
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND bsitzm...@wikimedia.org
Gerrit-Reviewer: Brion VIBBER br...@wikimedia.org
Gerrit-Reviewer: Dbrant dbr...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Enable basic ProGuard minification - change (apps...wikipedia)

2014-12-11 Thread BearND (Code Review)
BearND has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179174

Change subject: Enable basic ProGuard minification
..

Enable basic ProGuard minification

We can make the ProGuard config more aggressive later.
Want to keep it on the lighter side initially.
This is mainly driven by the desire to fix the bugs mentioned below.

Bug: T78197
Bug: T76279
Change-Id: Ic91e83e6dc4d25780dc8815318aba2e2a0c009fb
---
M wikipedia/build.gradle
M wikipedia/proguard-rules.pro
2 files changed, 60 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/74/179174/1

diff --git a/wikipedia/build.gradle b/wikipedia/build.gradle
index a4f3329..90f2360 100644
--- a/wikipedia/build.gradle
+++ b/wikipedia/build.gradle
@@ -17,7 +17,7 @@
 }
 buildTypes {
 release {
-minifyEnabled false
+minifyEnabled true
 proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
 signingConfig signingConfigs.release
 }
diff --git a/wikipedia/proguard-rules.pro b/wikipedia/proguard-rules.pro
index 200fdff..a5c166b 100644
--- a/wikipedia/proguard-rules.pro
+++ b/wikipedia/proguard-rules.pro
@@ -15,3 +15,62 @@
 #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
 #   public *;
 #}
+
+###
+# from https://github.com/ACRA/acra/wiki/ProGuard
+#ACRA specifics
+# Restore some Source file names and restore approximate line numbers in the 
stack traces,
+# otherwise the stack traces are pretty useless
+-keepattributes SourceFile,LineNumberTable
+
+# ACRA needs annotations so add this...
+# Note: This may already be defined in the default 
proguard-android-optimize.txt
+# file in the SDK. If it is, then you don't need to duplicate it. See your
+# project.properties file to get the path to the default 
proguard-android-optimize.txt.
+-keepattributes *Annotation*
+
+-keepattributes Signature
+
+## instead of the remaining ACRA proguard config: just keep all classes for now
+-keep class org.acra.** {*;}
+
+###
+# Other libraries:
+
+# https://github.com/square/okio/issues/60
+-dontwarn okio.**
+
+-dontwarn com.squareup.okhttp.**
+-dontnote com.squareup.okhttp.internal.Platform
+
+-keep class com.nineoldandroids.animation.** {*;}
+-keep class com.nineoldandroids.util.Property {*;}
+
+-keep class com.mobsandgeeks.saripaar.** {*;}
+
+-keep class com.squareup.picasso.** {*;}
+
+-keep class uk.co.senab.photoview.** {*;}
+
+-keep class com.github.kevinsawicki.http.** {*;}
+
+###
+# Android support libraries:
+
+# https://phabricator.wikimedia.org/T78197:
+# NoClassDefFoundError: android.support.v7.internal.view.menu.MenuBuilder
+# 
http://stackoverflow.com/questions/26657348/appcompat-v7-v21-0-0-causing-crash-on-samsung-devices-with-android-v4-2-2
+# Allow obfuscation of android.support.v7.internal.view.menu.** but not the 
rest of android.support
+# to avoid problem on Samsung 4.2.2 devices with appcompat v21
+# see https://code.google.com/p/android/issues/detail?id=78377#hc150
+-keep class !android.support.v7.internal.view.menu.MenuBuilder
+-keep class !android.support.v7.internal.view.menu.SubMenuBuilder
+
+-dontnote android.support.v4.text.ICUCompatIcs
+
+#-dontwarn android.support.**
+
+###
+# Our code:
+-keep class org.wikipedia.** {*;}
+-keep class org.mediawiki.api.json.** {*;}

-- 
To view, visit https://gerrit.wikimedia.org/r/179174
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic91e83e6dc4d25780dc8815318aba2e2a0c009fb
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND bsitzm...@wikimedia.org

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits