OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 ############################################################################### | 2 ############################################################################### |
3 # Copyright 2015 Google Inc. | 3 # Copyright 2015 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 ############################################################################### | 7 ############################################################################### |
8 # | 8 # |
9 # android_setup.sh: Sets environment variables used by other Android scripts. | 9 # android_setup.sh: Sets environment variables used by other Android scripts. |
10 | 10 |
11 # Fail-fast if anything in the script fails. | 11 # Fail-fast if anything in the script fails. |
12 set -e | 12 set -e |
13 | 13 |
14 BUILDTYPE=${BUILDTYPE-Debug} | 14 BUILDTYPE=${BUILDTYPE-Debug} |
| 15 USE_CLANG="false" |
15 | 16 |
16 while (( "$#" )); do | 17 while (( "$#" )); do |
17 if [[ "$1" == "-d" ]]; then | 18 if [[ "$1" == "-d" ]]; then |
18 DEVICE_ID=$2 | 19 DEVICE_ID=$2 |
19 shift | 20 shift |
20 elif [[ "$1" == "-i" || "$1" == "--resourcePath" ]]; then | 21 elif [[ "$1" == "-i" || "$1" == "--resourcePath" ]]; then |
21 RESOURCE_PATH=$2 | 22 RESOURCE_PATH=$2 |
22 APP_ARGS=("${APP_ARGS[@]}" "${1}" "${2}") | 23 APP_ARGS=("${APP_ARGS[@]}" "${1}" "${2}") |
23 shift | 24 shift |
24 elif [[ "$1" == "-s" ]]; then | 25 elif [[ "$1" == "-s" ]]; then |
25 DEVICE_SERIAL="-s $2" | 26 DEVICE_SERIAL="-s $2" |
26 shift | 27 shift |
27 elif [[ "$1" == "-t" ]]; then | 28 elif [[ "$1" == "-t" ]]; then |
28 BUILDTYPE=$2 | 29 BUILDTYPE=$2 |
29 shift | 30 shift |
30 elif [[ "$1" == "--release" ]]; then | 31 elif [[ "$1" == "--release" ]]; then |
31 BUILDTYPE=Release | 32 BUILDTYPE=Release |
| 33 elif [[ "$1" == "--gcc" ]]; then |
| 34 USE_CLANG="false" |
32 elif [[ "$1" == "--clang" ]]; then | 35 elif [[ "$1" == "--clang" ]]; then |
33 USE_CLANG="true" | 36 USE_CLANG="true" |
34 export GYP_DEFINES="skia_clang_build=1 $GYP_DEFINES" | |
35 elif [[ "$1" == "--logcat" ]]; then | 37 elif [[ "$1" == "--logcat" ]]; then |
36 LOGCAT=1 | 38 LOGCAT=1 |
37 elif [[ "$1" == "--verbose" ]]; then | 39 elif [[ "$1" == "--verbose" ]]; then |
38 VERBOSE="true" | 40 VERBOSE="true" |
39 else | 41 else |
40 APP_ARGS=("${APP_ARGS[@]}" "${1}") | 42 APP_ARGS=("${APP_ARGS[@]}" "${1}") |
41 fi | 43 fi |
42 shift | 44 shift |
43 done | 45 done |
44 | 46 |
| 47 if [ "$USE_CLANG" == "true" ]; then |
| 48 export GYP_DEFINES="skia_clang_build=1 $GYP_DEFINES" |
| 49 fi |
| 50 |
45 function verbose { | 51 function verbose { |
46 if [[ -n $VERBOSE ]]; then | 52 if [[ -n $VERBOSE ]]; then |
47 echo $@ | 53 echo $@ |
48 fi | 54 fi |
49 } | 55 } |
50 | 56 |
51 function exportVar { | 57 function exportVar { |
52 NAME=$1 | 58 NAME=$1 |
53 VALUE=$2 | 59 VALUE=$2 |
54 verbose export $NAME=\"$VALUE\" | 60 verbose export $NAME=\"$VALUE\" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 adb_push_if_needed $HOST_SRC $ANDROID_DST | 258 adb_push_if_needed $HOST_SRC $ANDROID_DST |
253 else | 259 else |
254 echo -n "$ANDROID_DST " | 260 echo -n "$ANDROID_DST " |
255 $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" | 261 $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" |
256 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST | 262 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST |
257 fi | 263 fi |
258 fi | 264 fi |
259 } | 265 } |
260 | 266 |
261 setup_device "${DEVICE_ID}" | 267 setup_device "${DEVICE_ID}" |
OLD | NEW |