xwords/xwords4/android/scripts/find-and-ant.sh

63 lines
1,001 B
Bash
Raw Normal View History

2014-02-02 20:27:09 +01:00
#!/bin/sh
set -e -u
MANIFEST=AndroidManifest.xml
INSTALL=''
CMDS=''
2014-02-02 20:27:09 +01:00
usage() {
[ $# -ge 1 ] && echo "ERROR: $1"
echo "usage: $0 <cmds to ant>"
2014-02-02 20:27:09 +01:00
exit 1
}
while [ $# -gt 0 ]; do
2014-02-02 20:27:09 +01:00
case $1 in
--help|-h|-help|-?)
usage
;;
clean|debug|release)
CMDS="$CMDS $1"
;;
install)
INSTALL=1
;;
*)
usage "Unexpected param $1"
;;
2014-02-02 20:27:09 +01:00
esac
shift
done
2014-02-02 20:27:09 +01:00
while [ ! -e $MANIFEST -o $(basename $(pwd)) = 'bin' ]; do
2014-02-02 20:27:09 +01:00
[ '/' = $(pwd) ] && usage "reached root without finding $MANIFEST"
cd ..
done
2014-02-07 16:34:09 +01:00
DIRNAME=$(basename $(pwd))
case $DIRNAME in
XWords4-bt)
PKG=xw4bt
;;
XWords4-dbg)
PKG=xw4dbg
;;
2014-02-07 16:34:09 +01:00
XWords4)
PKG=xw4
;;
*)
usage "running in unexpected directory $DIRNAME"
;;
esac
2014-02-02 20:27:09 +01:00
ant $CMDS
2014-02-07 16:34:09 +01:00
if [ -n "$INSTALL" ]; then
adb-install.sh -e -d
2014-02-07 16:34:09 +01:00
fi
# if [ "$CMDS" != "${CMDS%%install}" ]; then
# adb shell am start -n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.GamesListActivity
# fi