2013-08-12 12:30:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2015-02-03 23:07:30 +00:00
|
|
|
# android_install_app: installs the skia sampleApp on the device.
|
2013-08-12 12:30:04 +00:00
|
|
|
|
|
|
|
function print_usage {
|
2015-02-03 23:07:30 +00:00
|
|
|
echo "USAGE: android_install_app [options]"
|
2013-08-12 12:30:04 +00:00
|
|
|
echo " Options: -f Forces the package to be installed by removing any"
|
|
|
|
echo " previously installed packages"
|
|
|
|
echo " -h Prints this help message"
|
|
|
|
echo " --release Install the release build of Skia"
|
|
|
|
echo " -s [device_s/n] Serial number of the device to be used"
|
2015-07-24 20:15:58 +00:00
|
|
|
echo " AppName Can be either sample_app or VisualBench"
|
2013-08-12 12:30:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2013-08-20 12:22:57 +00:00
|
|
|
source $SCRIPT_DIR/android_setup.sh
|
2013-08-12 12:30:04 +00:00
|
|
|
source $SCRIPT_DIR/utils/setup_adb.sh
|
|
|
|
|
|
|
|
forceRemoval="false"
|
2015-06-18 20:08:26 +00:00
|
|
|
app=""
|
2013-08-12 12:30:04 +00:00
|
|
|
|
2015-06-18 20:08:26 +00:00
|
|
|
for arg in ${APP_ARGS[@]}; do
|
|
|
|
if [[ "${arg}" == "-f" ]]; then
|
2013-08-12 12:30:04 +00:00
|
|
|
forceRemoval="true"
|
2015-06-18 20:08:26 +00:00
|
|
|
elif [[ "${arg}" == "-h" ]]; then
|
2013-08-12 12:30:04 +00:00
|
|
|
print_usage
|
|
|
|
exit
|
2015-06-18 20:08:26 +00:00
|
|
|
elif [[ "${arg}" == "-r" ]]; then
|
2013-08-12 12:30:04 +00:00
|
|
|
echo "DEPRECATED: -r is now a no-op"
|
2015-06-18 20:08:26 +00:00
|
|
|
elif [[ ${arg} == '-'* ]]; then
|
2013-11-06 15:01:37 +00:00
|
|
|
echo "ERROR: unrecognized option ${arg}"
|
2013-08-12 12:30:04 +00:00
|
|
|
print_usage
|
|
|
|
exit 1;
|
2015-06-18 20:08:26 +00:00
|
|
|
else
|
|
|
|
if [[ ${app} != "" ]]; then
|
|
|
|
echo "ERROR: app already defined ${app}"
|
|
|
|
exit 1;
|
|
|
|
else
|
|
|
|
app=${arg}
|
|
|
|
fi
|
2013-08-12 12:30:04 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2015-06-18 20:08:26 +00:00
|
|
|
if [[ ${app} == "" ]]; then
|
2015-07-24 20:15:58 +00:00
|
|
|
echo "defaulting to installing sample_app."
|
|
|
|
app="sample_app"
|
2015-06-18 20:08:26 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2013-08-12 12:30:04 +00:00
|
|
|
if [[ "$forceRemoval" == "true" ]];
|
|
|
|
then
|
|
|
|
echo "Forcing removal of previously installed packages"
|
|
|
|
$ADB ${DEVICE_SERIAL} uninstall com.skia > /dev/null
|
|
|
|
fi
|
|
|
|
|
2015-07-31 17:25:17 +00:00
|
|
|
if [[ "$BUILDTYPE" == "Release" ]];
|
|
|
|
then
|
2015-08-10 15:58:03 +00:00
|
|
|
apk_suffix="release.apk"
|
2015-07-31 17:25:17 +00:00
|
|
|
else
|
|
|
|
apk_suffix="debug.apk"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2015-07-28 12:13:41 +00:00
|
|
|
APP_LC=$(echo $app | tr "[:upper:]" "[:lower:]")
|
2015-07-24 20:15:58 +00:00
|
|
|
|
2015-07-31 17:25:17 +00:00
|
|
|
echo "Installing ${APP_LC} from ${APP_LC}/build/outputs/apk/${APP_LC}-${ANDROID_ARCH}-${apk_suffix}"
|
|
|
|
$ADB ${DEVICE_SERIAL} install -r ${SCRIPT_DIR}/../apps/${APP_LC}/build/outputs/apk/${APP_LC}-${ANDROID_ARCH}-${apk_suffix}
|
2015-06-18 20:08:26 +00:00
|
|
|
|