| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # android_run_skia: starts the correct skia program on the device, prints the | 3 # android_run_skia: starts the correct skia program on the device, prints the |
| 4 # output, and kills the app if interrupted. | 4 # output, and kills the app if interrupted. |
| 5 | 5 |
| 6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 6 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 7 source $SCRIPT_DIR/android_setup.sh | 7 source $SCRIPT_DIR/android_setup.sh |
| 8 source $SCRIPT_DIR/utils/setup_adb.sh | 8 source $SCRIPT_DIR/utils/setup_adb.sh |
| 9 | 9 |
| 10 configuration="Debug" | 10 if [ ! -f "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" ]; |
| 11 | |
| 12 for arg in ${APP_ARGS[@]} | |
| 13 do | |
| 14 if [[ "${arg}" == "--release" ]]; | |
| 15 then | |
| 16 configuration="Release" | |
| 17 else | |
| 18 runVars=("${runVars[@]}" "${arg}") | |
| 19 fi | |
| 20 | |
| 21 shift | |
| 22 done | |
| 23 | |
| 24 if [ ! -f "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" ]; | |
| 25 then | 11 then |
| 26 echo "Unable to find the ${runVars[0]} library" | 12 echo "Unable to find $BUILDTYPE ${APP_ARGS[0]} library" |
| 27 exit 1 | 13 exit 1 |
| 28 fi | 14 fi |
| 29 | 15 |
| 30 adb_push_if_needed "${SKIA_OUT}/${configuration}/skia_launcher" /data/local/tmp | 16 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/skia_launcher" /data/local/tmp |
| 31 if [ -f "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" ]; then | 17 if [ -f "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" ]; then |
| 32 # Does not exist for builds with static skia. | 18 # Does not exist for builds with static skia. |
| 33 adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android.
so" /data/local/tmp | 19 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" /data/loc
al/tmp |
| 34 fi | 20 fi |
| 35 adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so"
/data/local/tmp | 21 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" /data/local
/tmp |
| 36 | 22 |
| 37 STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)" | 23 STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)" |
| 38 $ADB ${DEVICE_SERIAL} shell "/data/local/tmp/skia_launcher ${runVars[@]}; echo \
$? > ${STATUS_FILENAME}" | 24 $ADB ${DEVICE_SERIAL} shell \ |
| 25 "/data/local/tmp/skia_launcher ${APP_ARGS[@]}; echo \$? > ${STATUS_FILENAME}
" |
| 39 if [ -z "$($ADB $DEVICE_SERIAL shell 'if [ -f $STATUS_FILENAME ]; then echo exis
ts; fi')" ]; then | 26 if [ -z "$($ADB $DEVICE_SERIAL shell 'if [ -f $STATUS_FILENAME ]; then echo exis
ts; fi')" ]; then |
| 40 exit 1 | 27 exit 1 |
| 41 fi | 28 fi |
| 42 EXIT_CODE=`$ADB ${DEVICE_SERIAL} shell cat ${STATUS_FILENAME}` | 29 EXIT_CODE=`$ADB ${DEVICE_SERIAL} shell cat ${STATUS_FILENAME}` |
| 43 $ADB ${DEVICE_SERIAL} shell rm ${STATUS_FILENAME} | 30 $ADB ${DEVICE_SERIAL} shell rm ${STATUS_FILENAME} |
| 44 echo "EXIT_CODE is [${EXIT_CODE}]" | 31 echo "EXIT_CODE is ${EXIT_CODE}" |
| 45 if [ $'0\r' != "${EXIT_CODE}" ]; then | 32 if [ $'0\r' != "${EXIT_CODE}" ]; then |
| 46 exit 1 | 33 exit 1 |
| 47 fi | 34 fi |
| 48 exit 0 | 35 exit 0 |
| OLD | NEW |