merge remote changes

This commit is contained in:
Eric House 2016-03-08 07:27:30 -08:00
commit 5d9de30170
2 changed files with 33 additions and 20 deletions

View file

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/bash
set -u -e set -u -e
usage() { usage() {
[ $# -ge 1 ] && echo "Error: $1" [ $# -ge 1 ] && echo "Error: $1"
echo "usage: $(basename $0) [-e|-d] [-p /path/to/.apk]" echo "usage: $(basename $0) [-e|-d] (-p /path/to/.apk)+"
exit 1 exit 1
} }
@ -12,8 +12,11 @@ if [ ! -e build.xml ]; then
usage "No build.xml; please run me from the top android directory" usage "No build.xml; please run me from the top android directory"
fi fi
APK=./bin/XWords4-debug.apk APKS=''
DEVICES=''
DIRNAME=$(basename $(pwd)) DIRNAME=$(basename $(pwd))
ADB="$(which adb)"
case $DIRNAME in case $DIRNAME in
XWords4-dbg) XWords4-dbg)
PKG=xw4dbg PKG=xw4dbg
@ -29,22 +32,20 @@ case $DIRNAME in
;; ;;
esac esac
DEVICES=''
while [ $# -ge 1 ]; do while [ $# -ge 1 ]; do
case $1 in case $1 in
-e) -e)
DEV="$(adb devices | grep '^emulator' | awk '{print $1}')" DEV="$($ADB devices | grep '^emulator' | awk '{print $1}')"
DEVICES="$DEVICES $DEV" DEVICES="$DEVICES $DEV"
;; ;;
-d) -d)
DEV="$(adb devices | grep -v emulator | grep 'device$' | awk '{print $1}')" DEV="$($ADB devices | grep -v emulator | grep 'device$' | awk '{print $1}')"
DEVICES="$DEVICES $DEV" DEVICES="$DEVICES $DEV"
;; ;;
-p) -p)
[ $# -gt 1 ] || usage "-p requires an argument" [ $# -gt 1 ] || usage "-p requires an argument"
shift shift
APK=$1 APKS="$APKS $1"
;; ;;
*) *)
usage usage
@ -53,21 +54,29 @@ while [ $# -ge 1 ]; do
shift shift
done done
[ -e $APK ] || usage "$APK not found" if [ -z "$DEVICES" ]; then
while read LINE; do
if echo $LINE | grep -q "device$"; then
DEVICE=$(echo $LINE | awk '{print $1}')
DEVICES="$DEVICES $DEVICE"
fi
done <<< "$($ADB devices)"
fi
if [ -n "$DEVICES" ]; then # If no apk specified, take the newest built
echo "installing this binary. Check the age..." if [ -z "$APKS" ]; then
ls -l $APK APKS=$(ls -t bin/*.apk | head -n 1)
echo ""
fi fi
COUNT=0 COUNT=0
for DEVICE in $DEVICES; do for DEVICE in $DEVICES; do
echo $DEVICE for APK in $APKS; do
adb -s $DEVICE install -r $APK echo "installing $APK; details:"
adb -s $DEVICE shell am start \ ls -l $APK
$ADB -s $DEVICE install -r $APK
$ADB -s $DEVICE shell am start \
-n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.GamesListActivity -n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.GamesListActivity
done
COUNT=$((COUNT+1)) COUNT=$((COUNT+1))
done done

View file

@ -74,13 +74,17 @@ esac
# generate local.properties # generate local.properties
[ -e local.properties ] || ../scripts/setup_local_props.sh [ -e local.properties ] || ../scripts/setup_local_props.sh
# If this fails, the "set -e" above means we won't try to install anything
ant $CMDS ant $CMDS
if [ -n "$UNINSTALL" ]; then if [ -n "$UNINSTALL" ]; then
uninstall uninstall
fi fi
if [ -n "$INSTALL" ]; then if [ -n "$INSTALL" ]; then
adb-install.sh -e -d # Find the newest apk in this directory and install it
APK=$(ls -t bin/*.apk | head -n 1)
adb-install.sh -p $APK
fi fi
# if [ "$CMDS" != "${CMDS%%install}" ]; then # if [ "$CMDS" != "${CMDS%%install}" ]; then