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 if [ ! -f "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" ]; | 10 if [ ! -f "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" ]; |
11 then | 11 then |
12 echo "Unable to find $BUILDTYPE ${APP_ARGS[0]} library" | 12 echo "Unable to find $BUILDTYPE ${APP_ARGS[0]} library" |
13 exit 1 | 13 exit 1 |
14 fi | 14 fi |
15 | 15 |
| 16 ( |
| 17 SKIA_SRC_DIR=$(cd ${SCRIPT_DIR}/../../..; pwd) |
| 18 cd "$SKIA_SRC_DIR" |
| 19 for resource in $(find resources -type f); do |
| 20 adb_push_if_needed "$resource" "/data/local/tmp/${resource}" |
| 21 done |
| 22 ) |
16 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/skia_launcher" /data/local/tmp | 23 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/skia_launcher" /data/local/tmp |
17 if [ -f "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" ]; then | 24 if [ -f "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" ]; then |
18 # Does not exist for builds with static skia. | 25 # Does not exist for builds with static skia. |
19 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" /data/loc
al/tmp | 26 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" /data/loc
al/tmp |
20 fi | 27 fi |
21 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" /data/local
/tmp | 28 adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" /data/local
/tmp |
22 | 29 |
23 STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)" | 30 STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)" |
24 $ADB ${DEVICE_SERIAL} shell \ | 31 $ADB ${DEVICE_SERIAL} shell \ |
25 "/data/local/tmp/skia_launcher ${APP_ARGS[@]}; echo \$? > ${STATUS_FILENAME}
" | 32 "cd /data/local/tmp; ./skia_launcher ${APP_ARGS[@]}; echo \$? > ${STATUS_FIL
ENAME}" |
26 if [ -z "$($ADB $DEVICE_SERIAL shell 'if [ -f $STATUS_FILENAME ]; then echo exis
ts; fi')" ]; then | 33 if [ -z "$($ADB $DEVICE_SERIAL shell 'if [ -f $STATUS_FILENAME ]; then echo exis
ts; fi')" ]; then |
27 exit 1 | 34 exit 1 |
28 fi | 35 fi |
29 EXIT_CODE=`$ADB ${DEVICE_SERIAL} shell cat ${STATUS_FILENAME}` | 36 EXIT_CODE=`$ADB ${DEVICE_SERIAL} shell cat ${STATUS_FILENAME}` |
30 $ADB ${DEVICE_SERIAL} shell rm ${STATUS_FILENAME} | 37 $ADB ${DEVICE_SERIAL} shell rm ${STATUS_FILENAME} |
31 echo "EXIT_CODE is ${EXIT_CODE}" | 38 echo "EXIT_CODE is ${EXIT_CODE}" |
32 if [ $'0\r' != "${EXIT_CODE}" ]; then | 39 if [ $'0\r' != "${EXIT_CODE}" ]; then |
33 exit 1 | 40 exit 1 |
34 fi | 41 fi |
35 exit 0 | 42 exit 0 |
OLD | NEW |