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-23 15:00:33 +00:00
|
|
|
echo " AppName Can be either SampleApp 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-07-23 15:00:33 +00:00
|
|
|
installLauncher="false"
|
|
|
|
installOptions="-r"
|
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-23 15:00:33 +00:00
|
|
|
echo "defaulting to installing SampleApp."
|
|
|
|
app="SampleApp"
|
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-23 15:00:33 +00:00
|
|
|
echo "Installing ${app} from ${SKIA_OUT}/${BUILDTYPE}"
|
|
|
|
$ADB ${DEVICE_SERIAL} install ${installOptions} ${SKIA_OUT}/${BUILDTYPE}/android/${app}/bin/${app}.apk
|
2015-06-18 20:08:26 +00:00
|
|
|
|