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 | 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 APP_ARGS="" | 10 configuration="Debug" |
11 USE_INTENT="false" | |
12 SERIAL="" | |
13 | 11 |
14 while (( "$#" )); do | 12 for arg in ${APP_ARGS[@]} |
15 | 13 do |
16 if [[ "$1" == "--intent" ]]; | 14 if [[ "${arg}" == "--release" ]]; |
17 then | 15 then |
18 USE_INTENT="true" | 16 configuration="Release" |
19 elif [[ "$1" == "-s" ]]; | |
20 then | |
21 if [[ $# -lt 2 ]]; | |
22 then | |
23 echo "ERROR: missing serial number" | |
24 exit 1; | |
25 fi | |
26 SERIAL="-s $2" | |
27 shift | |
28 else | 17 else |
29 APP_ARGS="$APP_ARGS $1" | 18 runVars=("${runVars[@]}" "${arg}") |
30 fi | 19 fi |
31 | 20 |
32 shift | 21 shift |
33 done | 22 done |
34 | 23 |
| 24 if [ ! -f "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" ]; |
| 25 then |
| 26 echo "Unable to find the ${runVars[0]} library" |
| 27 exit 1 |
| 28 fi |
35 | 29 |
36 if [[ "$USE_INTENT" == "true" ]]; | 30 adb_push_if_needed "${SKIA_OUT}/${configuration}/skia_launcher" /data/local/tmp |
37 then | 31 adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so"
/data/local/tmp |
38 $ADB $SERIAL logcat -c | 32 adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so"
/data/local/tmp |
39 $ADB $SERIAL shell am broadcast -a com.skia.intent.action.LAUNCH_SKIA -n com
.skia/.SkiaReceiver -e args "$APP_ARGS" | 33 |
40 trap "echo \"Interrupt.\"" INT | 34 |
41 eval "($ADB $SERIAL logcat)" | 35 $ADB ${DEVICE_SERIAL} shell /data/local/tmp/skia_launcher ${runVars[@]} |
42 trap - INT | |
43 echo "Interrupt. Killing Skia process..." | |
44 $SCRIPT_DIR/android_kill_skia $SERIAL | |
45 echo "Done." | |
46 else | |
47 $ADB $SERIAL shell skia_launcher $APP_ARGS | |
48 fi | |
OLD | NEW |