mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
acf7097fda
My sign-inside-gradle is an uncommon trick and unnecessary. Better to follow the old convention of using jarsigner and zipalign.
65 lines
1.4 KiB
Bash
Executable file
65 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -u -e
|
|
|
|
TAGNAME=""
|
|
FILES=""
|
|
LIST_FILE=''
|
|
XW_WWW_PATH=${XW_WWW_PATH:-""}
|
|
XW_RELEASE_SCP_DEST=${XW_RELEASE_SCP_DEST:-""}
|
|
|
|
usage() {
|
|
echo "Error: $*" >&2
|
|
echo "usage: $0 [--tag <name>] [--apk-list path/to/out.txt] [<package-unsigned.apk>]" >&2
|
|
exit 1
|
|
}
|
|
|
|
do_build() {
|
|
(cd $(dirname $0)/../ && ./gradlew clean assembleXw4Rel)
|
|
}
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
case $1 in
|
|
--tag)
|
|
TAGNAME=$2
|
|
git describe $TAGNAME || usage "$TAGNAME not a valid git tag"
|
|
shift
|
|
;;
|
|
--apk-list)
|
|
LIST_FILE=$2
|
|
> $LIST_FILE
|
|
shift
|
|
;;
|
|
--help)
|
|
usage
|
|
;;
|
|
*)
|
|
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
|
|
for f in $(dirname $0)/../app/build/outputs/apk/*-unsigned-*.apk; do
|
|
$(dirname $0)/sign-align.sh --apk $f
|
|
done
|
|
fi
|
|
|
|
if [ -n "$TAGNAME" ]; then
|
|
git stash pop
|
|
git checkout android_branch 2>/dev/null
|
|
fi
|