xwords/xwords4/android/scripts/arelease.sh
Eric House 6a635d1631 Go back to using a built-in list item resource. Mine was
white-on-white on several OS versions.  Need to test further to try to
reproduce the conditions that had me trying to manage contrast myself.
Or use a dialog-themed Activity for lookup dialog -- prev checkins say
that was too slow but that might be fixable....
2012-03-06 07:41:33 -08:00

80 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
set -u -e
TAGNAME=""
FILES=""
VARIANT="XWords4"
XW_WWW_PATH=${XW_WWW_PATH:-""}
usage() {
echo "Error: $*"
echo "usage: $0 [--tag <name>] [--variant variant] [<package-unsigned.apk>]" >&2
exit 1
}
do_build() {
WD=$(pwd)
cd $(dirname $0)/../${VARIANT}/
rm -rf bin/ gen/
ant clean release
cd $WD
}
while [ "$#" -gt 0 ]; do
case $1 in
--tag)
TAGNAME=$2
git describe $TAGNAME || usage "$TAGNAME not a valid git tag"
shift
;;
--variant)
VARIANT=$2
shift
;;
*)
FILES="$1"
;;
esac
shift
done
if [ -n "$TAGNAME" ]; then
git branch 2>/dev/null | grep '\* android_branch' \
|| usage "not currently at android_branch"
git checkout $TAGNAME 2>/dev/null || usage "unable to checkout $TAGNAME"
HASH=$(git log -1 --pretty=format:%H)
CHECK_BRANCH=$(git describe $HASH 2>/dev/null)
if [ "$CHECK_BRANCH" != $TAGNAME ]; then
usage "tagname not found in repo or not as expected"
fi
git stash
fi
if [ -z "$FILES" ]; then
do_build
FILES=$(ls $(dirname $0)/../*/bin/*-unsigned.apk)
if [ -z "$FILES" ]; then
echo "unable to find any unsigned packages" >&2
usage
fi
fi
for PACK_UNSIGNED in $FILES; do
PACK_SIGNED=$(basename $PACK_UNSIGNED)
echo "base: $PACK_SIGNED"
PACK_SIGNED=${PACK_SIGNED/-unsigned}
echo "signed: $PACK_SIGNED"
jarsigner -verbose -keystore ~/.keystore $PACK_UNSIGNED mykey
rm -f $PACK_SIGNED
zipalign -v 4 $PACK_UNSIGNED $PACK_SIGNED
[ -n "$XW_WWW_PATH" ] && cp $PACK_SIGNED $XW_WWW_PATH
cp $PACK_SIGNED ${PACK_SIGNED%.apk}_$(git describe).apk
echo "created ${PACK_SIGNED%.apk}_$(git describe).apk"
done
if [ -n "$TAGNAME" ]; then
git stash pop
git checkout android_branch 2>/dev/null
fi