OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # android_install_app: installs the skia sampleApp on the device. | 3 # android_install_app: installs the skia sampleApp on the device. |
4 | 4 |
5 function print_usage { | 5 function print_usage { |
6 echo "USAGE: android_install_app [options]" | 6 echo "USAGE: android_install_app [options]" |
7 echo " Options: -f Forces the package to be installed by removing any
" | 7 echo " Options: -f Forces the package to be installed by removing any
" |
8 echo " previously installed packages" | 8 echo " previously installed packages" |
9 echo " -h Prints this help message" | 9 echo " -h Prints this help message" |
10 echo " --release Install the release build of Skia" | 10 echo " --release Install the release build of Skia" |
11 echo " -s [device_s/n] Serial number of the device to be used" | 11 echo " -s [device_s/n] Serial number of the device to be used" |
12 echo " AppName Can be either SampleApp or VisualBench" | 12 echo " AppName Can be either sample_app or VisualBench" |
13 } | 13 } |
14 | 14 |
15 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 15 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
16 | 16 |
17 source $SCRIPT_DIR/android_setup.sh | 17 source $SCRIPT_DIR/android_setup.sh |
18 source $SCRIPT_DIR/utils/setup_adb.sh | 18 source $SCRIPT_DIR/utils/setup_adb.sh |
19 | 19 |
20 forceRemoval="false" | 20 forceRemoval="false" |
21 installLauncher="false" | |
22 installOptions="-r" | |
23 app="" | 21 app="" |
24 | 22 |
25 for arg in ${APP_ARGS[@]}; do | 23 for arg in ${APP_ARGS[@]}; do |
26 if [[ "${arg}" == "-f" ]]; then | 24 if [[ "${arg}" == "-f" ]]; then |
27 forceRemoval="true" | 25 forceRemoval="true" |
28 elif [[ "${arg}" == "-h" ]]; then | 26 elif [[ "${arg}" == "-h" ]]; then |
29 print_usage | 27 print_usage |
30 exit | 28 exit |
31 elif [[ "${arg}" == "-r" ]]; then | 29 elif [[ "${arg}" == "-r" ]]; then |
32 echo "DEPRECATED: -r is now a no-op" | 30 echo "DEPRECATED: -r is now a no-op" |
33 elif [[ ${arg} == '-'* ]]; then | 31 elif [[ ${arg} == '-'* ]]; then |
34 echo "ERROR: unrecognized option ${arg}" | 32 echo "ERROR: unrecognized option ${arg}" |
35 print_usage | 33 print_usage |
36 exit 1; | 34 exit 1; |
37 else | 35 else |
38 if [[ ${app} != "" ]]; then | 36 if [[ ${app} != "" ]]; then |
39 echo "ERROR: app already defined ${app}" | 37 echo "ERROR: app already defined ${app}" |
40 exit 1; | 38 exit 1; |
41 else | 39 else |
42 app=${arg} | 40 app=${arg} |
43 fi | 41 fi |
44 fi | 42 fi |
45 done | 43 done |
46 | 44 |
47 if [[ ${app} == "" ]]; then | 45 if [[ ${app} == "" ]]; then |
48 echo "defaulting to installing SampleApp." | 46 echo "defaulting to installing sample_app." |
49 app="SampleApp" | 47 app="sample_app" |
50 fi | 48 fi |
51 | 49 |
52 | 50 |
53 if [[ "$forceRemoval" == "true" ]]; | 51 if [[ "$forceRemoval" == "true" ]]; |
54 then | 52 then |
55 echo "Forcing removal of previously installed packages" | 53 echo "Forcing removal of previously installed packages" |
56 $ADB ${DEVICE_SERIAL} uninstall com.skia > /dev/null | 54 $ADB ${DEVICE_SERIAL} uninstall com.skia > /dev/null |
57 fi | 55 fi |
58 | 56 |
59 echo "Installing ${app} from ${SKIA_OUT}/${BUILDTYPE}" | 57 BUILD_TYPE_LC=$(echo $BUILDTYPE | tr "[:upper:]" "[:lower:]") |
60 $ADB ${DEVICE_SERIAL} install ${installOptions} ${SKIA_OUT}/${BUILDTYPE}/android
/${app}/bin/${app}.apk | |
61 | 58 |
| 59 echo "Installing ${app} from ${app}/build/outputs/apk/${app}-${ANDROID_ARCH}-${B
UILD_TYPE_LC}.apk" |
| 60 $ADB ${DEVICE_SERIAL} install -r ${SCRIPT_DIR}/../apps/${app}/build/outputs/apk/
${app}-${ANDROID_ARCH}-${BUILD_TYPE_LC}.apk |
| 61 |
OLD | NEW |