minor fixes

This commit is contained in:
renaud gaudin 2015-06-07 22:48:53 +02:00
parent 070d0f9df3
commit 4e0e769e90
2 changed files with 17 additions and 5 deletions

View File

@ -21,10 +21,22 @@ function die {
exit 1 exit 1
} }
if [ "x$2" = "x" ];
then
PACKAGE=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('package').strip() for e in d.getElementsByTagName('manifest')][-1])"`
else
PACKAGE=$2
fi
if [ "x$3" = "x" ];
then
APP_VERSION=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('android:versionName').strip() for e in d.getElementsByTagName('manifest')][-1])"`
else
APP_VERSION=$3
fi
# default values are guessed from repo (AndroidManifest and res/values/branding) # default values are guessed from repo (AndroidManifest and res/values/branding)
APP_NAME=`python -c "from xml.dom.minidom import parse; d=parse('res/values/branding.xml'); print([e.childNodes[0].data.strip() for e in d.getElementsByTagName('string') if e.getAttribute('name') == 'app_name'][-1])"` APP_NAME=`python -c "from xml.dom.minidom import parse; d=parse('res/values/branding.xml'); print([e.childNodes[0].data.strip() for e in d.getElementsByTagName('string') if e.getAttribute('name') == 'app_name'][-1])"`
PACKAGE=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('package').strip() for e in d.getElementsByTagName('manifest')][-1])"`
APP_VERSION=`python -c "from xml.dom.minidom import parse; d=parse('AndroidManifest.xml'); print([e.getAttribute('android:versionName').strip() for e in d.getElementsByTagName('manifest')][-1])"`
TARGET_VERSION=`grep "compileSdkVersion" build.gradle | awk '{print $2}'` TARGET_VERSION=`grep "compileSdkVersion" build.gradle | awk '{print $2}'`
BUILD_VERSION=`grep "buildToolsVersion" build.gradle | awk '{print $2}' | sed 's/"//g'` BUILD_VERSION=`grep "buildToolsVersion" build.gradle | awk '{print $2}' | sed 's/"//g'`
@ -47,7 +59,7 @@ fi
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore $CERTIFICATE build/outputs/apk/${PACKAGE}-release-unsigned.apk kiwix || die "Error signing the package." jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore $CERTIFICATE build/outputs/apk/${PACKAGE}-release-unsigned.apk kiwix || die "Error signing the package."
jarsigner -verify build/outputs/apk/${PACKAGE}-release-unsigned.apk || die "The package is not properly signed." jarsigner -verify build/outputs/apk/${PACKAGE}-release-unsigned.apk || die "The package is not properly signed."
../src/dependencies/android-sdk/build-tools/${BUILD_VERSION}/zipalign -f -v 4 build/outputs/apk/${PACKAGE}-release-unsigned.apk "${APP_NAME}-${APP_VERSION}.apk" || die "Could not zipalign the signed package. Please check." ../src/dependencies/android-sdk/build-tools/${BUILD_VERSION}/zipalign -f -v 4 build/outputs/apk/${PACKAGE}-release-unsigned.apk build/outputs/apk/${PACKAGE}-${APP_VERSION}.apk || die "Could not zipalign the signed package. Please check."
echo "[SUCCESS] Your signed release package is ready:" echo "[SUCCESS] Your signed release package is ready:"
ls -lh "${APP_NAME}-${APP_VERSION}.apk" ls -lh build/outputs/apk/${PACKAGE}-${APP_VERSION}.apk

View File

@ -497,8 +497,8 @@ ARGS_MATRIX = OrderedDict([
('gradle', step_update_gradle), ('gradle', step_update_gradle),
('build', step_build_apk), ('build', step_build_apk),
('move', step_move_apk_to_destination), ('move', step_move_apk_to_destination),
('clean', step_remove_android_placeholder),
('list', step_list_output_apk), ('list', step_list_output_apk),
('clean', step_remove_android_placeholder),
]) ])