mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Activate ProGuard; test signed release APK instead of debug
This commit is contained in:
BIN
TestKeystore.jks
Normal file
BIN
TestKeystore.jks
Normal file
Binary file not shown.
@@ -22,7 +22,7 @@ android {
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
debug {
|
||||
|
||||
@@ -1,3 +1,43 @@
|
||||
-dontwarn java.beans.**
|
||||
-dontwarn java.lang.**
|
||||
-dontwarn java.**
|
||||
-dontwarn javax.**
|
||||
-dontwarn com.google.auto.**
|
||||
-dontwarn com.google.errorprone.annotations.**
|
||||
-dontwarn com.google.j2objc.annotations.**
|
||||
-dontwarn okio.**
|
||||
-dontwarn okhttp3.**
|
||||
-dontwarn sun.misc.**
|
||||
-dontwarn org.codehaus.mojo.**
|
||||
-dontwarn com.google.gson.internal.*
|
||||
-dontwarn com.google.common.util.concurrent.*
|
||||
-dontwarn com.google.auto.common.*
|
||||
-dontwarn org.apache.commons.beanutils.*
|
||||
-dontwarn org.isoron.uhabits.HabitsApplication
|
||||
|
||||
-dontobfuscate
|
||||
|
||||
-keep class sun.misc.Unsafe { *; }
|
||||
-keep class org.isoron.** { *; }
|
||||
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Application
|
||||
-keep public class * extends android.app.Service
|
||||
-keep public class * extends android.content.BroadcastReceiver
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
-keep public class * extends android.preference.Preference
|
||||
-keep public class * extends android.view.View {
|
||||
public <init>(android.content.Context);
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet);
|
||||
}
|
||||
-keepclasseswithmembers class * {
|
||||
public <init>(android.content.Context, android.util.AttributeSet, int);
|
||||
}
|
||||
-keepclassmembers class * extends android.content.Context {
|
||||
public void *(android.view.View);
|
||||
public void *(android.view.MenuItem);
|
||||
}
|
||||
-keep public class * extends android.app.Activity
|
||||
-dontskipnonpubliclibraryclassmembers
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
||||
~
|
||||
~ This file is part of Loop Habit Tracker.
|
||||
~
|
||||
~ Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by the
|
||||
~ Free Software Foundation, either version 3 of the License, or (at your
|
||||
~ option) any later version.
|
||||
~
|
||||
~ Loop Habit Tracker is distributed in the hope that it will be useful, but
|
||||
~ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
~ more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along
|
||||
~ with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<manifest
|
||||
package="org.isoron.uhabits"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.SET_ANIMATION_SCALE"/>
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
tools:replace="maxSdkVersion"
|
||||
android:maxSdkVersion="99" />
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
tools:replace="maxSdkVersion"
|
||||
android:maxSdkVersion="99" />
|
||||
|
||||
</manifest>
|
||||
46
run_tests
46
run_tests
@@ -19,12 +19,18 @@ fi
|
||||
|
||||
AVD_NAME=$1
|
||||
AVD_SERIAL=$2
|
||||
|
||||
ADB="${ANDROID_HOME}/platform-tools/adb -s emulator-${AVD_SERIAL}"
|
||||
EMULATOR="${ANDROID_HOME}/tools/emulator"
|
||||
GRADLE="./gradlew --no-daemon --stacktrace"
|
||||
GRADLE="./gradlew --stacktrace"
|
||||
PACKAGE_NAME=org.isoron.uhabits
|
||||
OUTPUTS_DIR=app/build/outputs
|
||||
|
||||
KEYFILE="TestKeystore.jks"
|
||||
KEY_ALIAS="default"
|
||||
KEY_PASSWORD="qwe123"
|
||||
STORE_PASSWORD="qwe123"
|
||||
|
||||
info() {
|
||||
if [ ! -z "$TEAMCITY_VERSION" ]; then
|
||||
echo "###teamcity[progressMessage '$1']"
|
||||
@@ -35,8 +41,12 @@ info() {
|
||||
fi
|
||||
}
|
||||
|
||||
fail() {
|
||||
cleanup() {
|
||||
$ADB emu kill
|
||||
$GRADLE --stop
|
||||
}
|
||||
|
||||
fail() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -56,24 +66,36 @@ rm -rf ${OUTPUTS_DIR}
|
||||
mkdir -p ${OUTPUTS_DIR}
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
info "Building instrumentation APKs"
|
||||
$GRADLE assembleDebug assembleAndroidTest || fail
|
||||
info "Building release APK"
|
||||
./gradlew assembleRelease \
|
||||
-Pandroid.injected.signing.store.file=$KEYFILE \
|
||||
-Pandroid.injected.signing.store.password=$STORE_PASSWORD \
|
||||
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
|
||||
-Pandroid.injected.signing.key.password=$KEY_PASSWORD || fail
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
info "Building instrumentation APK"
|
||||
$GRADLE assembleAndroidTest \
|
||||
-Pandroid.injected.signing.store.file=$KEYFILE \
|
||||
-Pandroid.injected.signing.store.password=$STORE_PASSWORD \
|
||||
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
|
||||
-Pandroid.injected.signing.key.password=$KEY_PASSWORD || fail
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
info "Installing APKs"
|
||||
$ADB install -r ${OUTPUTS_DIR}/apk/app-debug.apk || fail
|
||||
$ADB uninstall ${PACKAGE_NAME}
|
||||
$ADB install -r ${OUTPUTS_DIR}/apk/app-release.apk || fail
|
||||
$ADB install -r ${OUTPUTS_DIR}/apk/app-debug-androidTest.apk || fail
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
info "Granting permissions"
|
||||
$ADB shell pm grant org.isoron.uhabits android.permission.SET_ANIMATION_SCALE || fail
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
info "Running instrumentation tests"
|
||||
$ADB shell am instrument -r -e coverage true -e size medium \
|
||||
$ADB shell am instrument \
|
||||
-r -e coverage true -e size medium \
|
||||
-w ${PACKAGE_NAME}.test/android.support.test.runner.AndroidJUnitRunner \
|
||||
> ${OUTPUTS_DIR}/instrument.txt
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
info "Parsing test results"
|
||||
java -jar tools/automator-log-converter-1.5.0.jar ${OUTPUTS_DIR}/instrument.txt || fail
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
@@ -103,7 +125,7 @@ info "Uninstalling test APK"
|
||||
$ADB uninstall ${PACKAGE_NAME}.test || fail
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
info "Stopping emulator"
|
||||
$ADB emu kill
|
||||
info "Stopping emulator and cleaning up"
|
||||
cleanup
|
||||
|
||||
exit $failed
|
||||
|
||||
Reference in New Issue
Block a user