Fixed generation and install of custom apps

This commit is contained in:
Isaac Hutt 2017-03-18 18:59:52 +00:00
parent 2297c10cec
commit 5523edec26
2 changed files with 14 additions and 4 deletions

View File

@ -490,6 +490,16 @@ def step_build_apk(jsdata, **options):
syscall('./gradlew build --stacktrace')
# rename APKs for better listing
folder_name = os.path.split(ANDROID_PATH)[-1]
for variant in ('debug', 'release-unsigned'):
shutil.move(os.path.join('build', 'outputs', 'apk',
"{}-{}.apk".format(folder_name, variant)),
os.path.join('build', 'outputs', 'apk',
"{}-{}.apk".format(jsdata.get('package'), variant)))
def step_move_apk_to_destination(jsdata, **options):
""" place and rename built APKs to main output directory """
@ -501,7 +511,7 @@ def step_move_apk_to_destination(jsdata, **options):
except OSError:
pass
# move generated APK to satisfy other scripts
for variant in ('debug', 'debug-unaligned', 'release-unsigned'):
for variant in ('debug', 'release-unsigned'):
shutil.move(os.path.join(ANDROID_PATH, 'build', 'outputs', 'apk',
"{}-{}.apk"
.format(jsdata.get('package'), variant)),

View File

@ -8,12 +8,12 @@ if [ "x$1" != "x" ];
PACKAGE=$1
fi
if [ -f build/outputs/apk/${PACKAGE}-debug-unaligned.apk ]
if [ -f build/outputs/apk/${PACKAGE}-debug.apk ]
then
echo "Uninstalling old Kiwix APK..."
../src/dependencies/android-sdk/platform-tools/adb uninstall ${PACKAGE} ;
${ANDROID_HOME}/platform-tools/adb uninstall ${PACKAGE} ;
echo "Installing new Kiwix APK..."
../src/dependencies/android-sdk/platform-tools/adb install build/outputs/apk/${PACKAGE}-debug-unaligned.apk
${ANDROID_HOME}/platform-tools/adb install build/outputs/apk/${PACKAGE}-debug.apk
else
echo "No APK file available for package ${PACKAGE} !"
fi