Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: platform_tools/android/bin/android_setup.sh

Issue 352303003: Push resources to Android device (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: little style fix Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « platform_tools/android/bin/android_run_skia ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # android_setup.sh: Sets environment variables used by other Android scripts. 3 # android_setup.sh: Sets environment variables used by other Android scripts.
4 4
5 # Fail-fast if anything in the script fails. 5 # Fail-fast if anything in the script fails.
6 set -e 6 set -e
7 7
8 BUILDTYPE=${BUILDTYPE-Debug} 8 BUILDTYPE=${BUILDTYPE-Debug}
9 9
10 while (( "$#" )); do 10 while (( "$#" )); do
11 if [[ "$1" == "-d" ]]; then 11 if [[ "$1" == "-d" ]]; then
12 DEVICE_ID=$2 12 DEVICE_ID=$2
13 shift 13 shift
14 elif [[ "$1" == "-i" || "$1" == "--resourcePath" ]]; then
15 RESOURCE_PATH=$2
16 APP_ARGS=("${APP_ARGS[@]}" "${1}" "${2}")
17 shift
14 elif [[ "$1" == "-s" ]]; then 18 elif [[ "$1" == "-s" ]]; then
15 DEVICE_SERIAL="-s $2" 19 DEVICE_SERIAL="-s $2"
16 shift 20 shift
17 elif [[ "$1" == "-t" ]]; then 21 elif [[ "$1" == "-t" ]]; then
18 BUILDTYPE=$2 22 BUILDTYPE=$2
19 shift 23 shift
20 elif [[ "$1" == "--release" ]]; then 24 elif [[ "$1" == "--release" ]]; then
21 BUILDTYPE=Release 25 BUILDTYPE=Release
22 else 26 else
23 APP_ARGS=("${APP_ARGS[@]}" "${1}") 27 APP_ARGS=("${APP_ARGS[@]}" "${1}")
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 fi 202 fi
199 } 203 }
200 204
201 # adb_push_if_needed(host_src, android_dst) 205 # adb_push_if_needed(host_src, android_dst)
202 adb_push_if_needed() { 206 adb_push_if_needed() {
203 207
204 # get adb location 208 # get adb location
205 source $SCRIPT_DIR/utils/setup_adb.sh 209 source $SCRIPT_DIR/utils/setup_adb.sh
206 210
207 # read input params 211 # read input params
208 HOST_SRC="$1" 212 local HOST_SRC="$1"
209 ANDROID_DST="$2" 213 local ANDROID_DST="$2"
210 214
211 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` 215 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST`
212 if [ "${ANDROID_LS:0:1}" == "d" ]; 216 HOST_LS=`ls -ld $HOST_SRC`
217 if [ "${ANDROID_LS:0:1}" == "d" -a "${HOST_LS:0:1}" == "-" ];
213 then 218 then
214 ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})" 219 ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})"
215 fi 220 fi
216 221
217 222
218 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` 223 ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST`
219 if [ "${ANDROID_LS:0:1}" == "-" ]; then 224 if [ "${ANDROID_LS:0:1}" == "-" ]; then
220 #get the MD5 for dst and src 225 #get the MD5 for dst and src
221 ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5 $ANDROID_DST` 226 ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5 $ANDROID_DST`
222 if [ $(uname) == "Darwin" ]; then 227 if [ $(uname) == "Darwin" ]; then
223 HOST_MD5=`md5 -q $HOST_SRC` 228 HOST_MD5=`md5 -q $HOST_SRC`
224 else 229 else
225 HOST_MD5=`md5sum $HOST_SRC` 230 HOST_MD5=`md5sum $HOST_SRC`
226 fi 231 fi
227 232
228 if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; then 233 if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; then
229 echo -n "$ANDROID_DST " 234 echo -n "$ANDROID_DST "
230 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST 235 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST
231 fi 236 fi
237 elif [ "${ANDROID_LS:0:1}" == "d" ]; then
238 for FILE_ITEM in `ls $HOST_SRC`; do
239 adb_push_if_needed "${HOST_SRC}/${FILE_ITEM}" "${ANDROID_DST}/${FILE_ITEM} "
240 done
232 else 241 else
233 echo -n "$ANDROID_DST " 242 HOST_LS=`ls -ld $HOST_SRC`
234 $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" 243 if [ "${HOST_LS:0:1}" == "d" ]; then
235 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST 244 $ADB $DEVICE_SERIAL shell mkdir -p $ANDROID_DST
245 adb_push_if_needed $HOST_SRC $ANDROID_DST
246 else
247 echo -n "$ANDROID_DST "
248 $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")"
249 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST
250 fi
236 fi 251 fi
237 } 252 }
238 253
239 setup_device "${DEVICE_ID}" 254 setup_device "${DEVICE_ID}"
OLDNEW
« no previous file with comments | « platform_tools/android/bin/android_run_skia ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698