Fix the connectedCheck build target

1) Create a new build type for testing.
2) Only obfuscate the package android.support.v7.internal.view.menu
   to prevent LGE ROM bug
3) '-keepattributes Exceptions' to allow for throwing from mocks
4) -dontskipnonpubliclibraryclassmembers and -dontwarn for
   everything else

Fixes #2871
Closes #2986

// FREEBIE
This commit is contained in:
Rhodey Orbits 2015-04-07 17:36:00 -07:00 committed by Moxie Marlinspike
parent f42d100f15
commit a413346610
3 changed files with 19 additions and 3 deletions

View File

@ -127,6 +127,7 @@ dependencyVerification {
android { android {
compileSdkVersion 22 compileSdkVersion 22
buildToolsVersion '22.0.1' buildToolsVersion '22.0.1'
testBuildType "testing"
dexOptions { dexOptions {
javaMaxHeapSize "4g" javaMaxHeapSize "4g"
@ -188,6 +189,10 @@ android {
'proguard.cfg' 'proguard.cfg'
signingConfig signingConfigs.release signingConfig signingConfigs.release
} }
testing.initWith(buildTypes.debug)
testing {
proguardFile 'proguard-testing.pro'
}
} }
sourceSets { sourceSets {

View File

@ -1,8 +1,9 @@
# https://code.google.com/p/android/issues/detail?id=78377
-keepnames class !android.support.v7.internal.view.menu.**, ** { *; }
-keep public class android.support.v7.widget.** { *; } -keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; } -keep public class android.support.v7.internal.widget.** { *; }
# below line disabled due to LGE ROM bug.
# -keep public class android.support.v7.internal.view.menu.** { *; }
-keep public class * extends android.support.v4.view.ActionProvider { -keep public class * extends android.support.v4.view.ActionProvider {
public <init>(android.content.Context); public <init>(android.content.Context);
} }

10
proguard-testing.pro Normal file
View File

@ -0,0 +1,10 @@
-keepattributes Exceptions
-dontskipnonpubliclibraryclassmembers
-dontwarn android.test.**
-dontwarn com.android.support.test.**
-dontwarn sun.reflect.**
-dontwarn org.assertj.**
-dontwarn org.hamcrest.**
-dontwarn org.mockito.**
-dontwarn com.squareup.**