mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
improve script. Allow pass either branch or tag on commandline,
defaulting to branch of tree from which called. Add usage(). set -u -e and deal with [ -n "$1" ] being an error in that case.
This commit is contained in:
parent
46a01ace56
commit
57838c0436
1 changed files with 44 additions and 8 deletions
|
@ -1,19 +1,55 @@
|
|||
#!/bin/sh
|
||||
|
||||
BUILDIR=/tmp/$(basename $0)_build_$$
|
||||
CURDIR=$(pwd)
|
||||
SRCDIR=${CURDIR}/../../../
|
||||
set -e -u
|
||||
|
||||
echo $BUILDIR
|
||||
echo $SRCDIR
|
||||
ls $SRCDIR
|
||||
usage () {
|
||||
echo "usage: $(basename $0) [--tag tagname | --branch branchname]"
|
||||
echo " # (uses current branch as default)"
|
||||
exit 0
|
||||
}
|
||||
|
||||
TAG=""
|
||||
BRANCH=""
|
||||
|
||||
while [ 0 -lt $# ] ; do
|
||||
case $1 in
|
||||
--tag)
|
||||
TAG=$2
|
||||
shift
|
||||
;;
|
||||
--branch)
|
||||
BRANCH=$2
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -n "$TAG" ]; then
|
||||
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
|
||||
|
||||
echo "building with ${TAG}${BRANCH}"
|
||||
|
||||
BUILDIR=/tmp/$(basename $0)_build_$$
|
||||
SRCDIR=$(pwd)/$(dirname $0)/../../../
|
||||
|
||||
CURDIR=$(pwd)
|
||||
|
||||
mkdir -p $BUILDIR
|
||||
cd $BUILDIR
|
||||
git clone $SRCDIR BUILD
|
||||
cd BUILD
|
||||
git checkout android_branch
|
||||
./xwords4/android/scripts/arelease.sh $*
|
||||
git checkout ${TAG}${BRANCH}
|
||||
./xwords4/android/scripts/arelease.sh
|
||||
cp *.apk /tmp
|
||||
|
||||
cd $CURDIR
|
||||
|
|
Loading…
Reference in a new issue