2010-11-07 04:19:07 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-11-07 17:16:36 +01:00
|
|
|
set -e -u
|
|
|
|
|
|
|
|
usage () {
|
2022-08-11 03:18:08 +02:00
|
|
|
[ "$#" -gt 1 ] && echo "ERROR: $1"
|
|
|
|
echo "usage: $(basename $0) --variant VARIANT \\"
|
|
|
|
echo " [--tag tagname | --branch branchname] \\"
|
2010-11-07 17:16:36 +01:00
|
|
|
echo " # (uses current branch as default)"
|
2019-01-25 02:59:50 +01:00
|
|
|
echo " # e.g. $0 --tag android_beta_141 --variant Xw4d"
|
2022-04-26 18:48:44 +02:00
|
|
|
echo "Here are some possible variants:"
|
|
|
|
for VAR in $(./gradlew tasks | grep assembleXw4 | awk '{print $1}' | sed -e 's/assemble//'); do
|
|
|
|
echo " $VAR"
|
|
|
|
done
|
2016-02-25 07:16:56 +01:00
|
|
|
exit 1
|
2010-11-07 17:16:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TAG=""
|
|
|
|
BRANCH=""
|
2012-05-11 16:32:02 +02:00
|
|
|
|
2010-11-07 17:16:36 +01:00
|
|
|
while [ 0 -lt $# ] ; do
|
|
|
|
case $1 in
|
|
|
|
--tag)
|
|
|
|
TAG=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--branch)
|
|
|
|
BRANCH=$2
|
|
|
|
shift
|
|
|
|
;;
|
2019-01-25 02:59:50 +01:00
|
|
|
--variant)
|
|
|
|
VARIANT=$2
|
|
|
|
shift
|
|
|
|
;;
|
2010-11-07 17:16:36 +01:00
|
|
|
*)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2022-08-11 03:18:08 +02:00
|
|
|
if [ -z "${VARIANT-}" ]; then
|
|
|
|
usage "param --variant is not optional"
|
|
|
|
elif [ -n "$TAG" ]; then
|
2010-11-07 17:16:36 +01:00
|
|
|
if ! git tag | grep -w "$TAG"; then
|
|
|
|
echo "tag $TAG not found"
|
|
|
|
usage
|
|
|
|
fi
|
|
|
|
elif [ -z $BRANCH ]; then
|
|
|
|
BRANCH=$(git branch | grep '^*' | sed 's,^.* ,,')
|
|
|
|
fi
|
|
|
|
|
2017-01-19 04:56:03 +01:00
|
|
|
echo "building with ${TAG}${BRANCH}"
|
2010-11-07 17:16:36 +01:00
|
|
|
|
2010-11-07 04:19:07 +01:00
|
|
|
BUILDIR=/tmp/$(basename $0)_build_$$
|
2014-08-29 16:33:21 +02:00
|
|
|
OUT_FILE=$BUILDIR/apks.txt
|
2010-11-07 17:16:36 +01:00
|
|
|
SRCDIR=$(pwd)/$(dirname $0)/../../../
|
2010-11-07 04:19:07 +01:00
|
|
|
|
2010-11-07 17:16:36 +01:00
|
|
|
CURDIR=$(pwd)
|
2010-11-07 04:19:07 +01:00
|
|
|
|
|
|
|
mkdir -p $BUILDIR
|
|
|
|
cd $BUILDIR
|
|
|
|
git clone $SRCDIR BUILD
|
|
|
|
cd BUILD
|
2010-11-07 17:16:36 +01:00
|
|
|
git checkout ${TAG}${BRANCH}
|
2017-01-19 04:56:03 +01:00
|
|
|
cd ./xwords4/android/
|
2019-01-25 02:59:50 +01:00
|
|
|
./scripts/arelease.sh --apk-list $OUT_FILE --variant $VARIANT
|
2017-01-19 06:27:48 +01:00
|
|
|
mkdir -p /tmp/releases
|
2019-01-25 02:59:50 +01:00
|
|
|
cp app/build/outputs/apk/*/release/*.apk /tmp/releases
|
2010-11-07 04:19:07 +01:00
|
|
|
|
2014-08-29 16:33:21 +02:00
|
|
|
if [ -n "$XW_RELEASE_SCP_DEST" ]; then
|
|
|
|
cat $OUT_FILE | while read APK; do
|
2017-01-19 06:27:48 +01:00
|
|
|
echo "running: scp /tmp/releases/$APK $XW_RELEASE_SCP_DEST ..."
|
|
|
|
scp /tmp/releases/$APK $XW_RELEASE_SCP_DEST
|
2014-08-29 16:33:21 +02:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2010-11-07 04:19:07 +01:00
|
|
|
cd $CURDIR
|
2014-05-06 15:58:57 +02:00
|
|
|
echo "remove build dir $BUILDIR? (y or n):"
|
2014-06-22 20:15:44 +02:00
|
|
|
echo -n "(y or n) ==> "
|
2014-05-06 15:58:57 +02:00
|
|
|
read ANSWER
|
|
|
|
if [ "$ANSWER" = 'y' ]; then
|
|
|
|
rm -rf $BUILDIR
|
|
|
|
echo "removed $BUILDIR"
|
|
|
|
else
|
|
|
|
echo "$BUILDIR not removed"
|
|
|
|
fi
|