2013-04-29 12:09:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# android_run_skia: starts the correct skia program on the device, prints the
|
|
|
|
# output, and kills the app if interrupted.
|
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2013-08-12 12:30:04 +00:00
|
|
|
source $SCRIPT_DIR/android_setup.sh
|
2013-04-29 12:09:31 +00:00
|
|
|
source $SCRIPT_DIR/utils/setup_adb.sh
|
|
|
|
|
2013-08-12 12:30:04 +00:00
|
|
|
configuration="Debug"
|
|
|
|
|
|
|
|
for arg in ${APP_ARGS[@]}
|
|
|
|
do
|
|
|
|
if [[ "${arg}" == "--release" ]];
|
|
|
|
then
|
|
|
|
configuration="Release"
|
2013-04-29 12:09:31 +00:00
|
|
|
else
|
2013-08-12 12:30:04 +00:00
|
|
|
runVars=("${runVars[@]}" "${arg}")
|
2013-04-29 12:09:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2013-08-12 12:30:04 +00:00
|
|
|
if [ ! -f "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" ];
|
2013-04-29 12:09:31 +00:00
|
|
|
then
|
2013-08-12 12:30:04 +00:00
|
|
|
echo "Unable to find the ${runVars[0]} library"
|
|
|
|
exit 1
|
2013-04-29 12:09:31 +00:00
|
|
|
fi
|
2013-08-12 12:30:04 +00:00
|
|
|
|
|
|
|
adb_push_if_needed "${SKIA_OUT}/${configuration}/skia_launcher" /data/local/tmp
|
2013-12-02 13:50:38 +00:00
|
|
|
if [ -f "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" ]; then
|
|
|
|
# Does not exist for builds with static skia.
|
|
|
|
adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/libskia_android.so" /data/local/tmp
|
|
|
|
fi
|
2013-08-12 12:30:04 +00:00
|
|
|
adb_push_if_needed "${SKIA_OUT}/${configuration}/lib.target/lib${runVars[0]}.so" /data/local/tmp
|
|
|
|
|
2013-08-22 21:57:22 +00:00
|
|
|
STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)"
|
|
|
|
$ADB ${DEVICE_SERIAL} shell "/data/local/tmp/skia_launcher ${runVars[@]}; echo \$? > ${STATUS_FILENAME}"
|
2013-09-27 14:28:45 +00:00
|
|
|
if [ -z "$($ADB $DEVICE_SERIAL shell 'if [ -f $STATUS_FILENAME ]; then echo exists; fi')" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-08-22 21:57:22 +00:00
|
|
|
EXIT_CODE=`$ADB ${DEVICE_SERIAL} shell cat ${STATUS_FILENAME}`
|
|
|
|
$ADB ${DEVICE_SERIAL} shell rm ${STATUS_FILENAME}
|
2014-03-20 17:32:27 +00:00
|
|
|
echo "EXIT_CODE is [${EXIT_CODE}]"
|
2013-08-22 21:57:22 +00:00
|
|
|
if [ $'0\r' != ${EXIT_CODE} ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-03-20 17:32:27 +00:00
|
|
|
exit 0
|