OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
| 3 # Fail-fast if anything in the script fails. |
| 4 set -e |
| 5 |
| 6 # Remove any existing .android_config file before running android_setup. If we |
| 7 # did not remove this now then we would build for whatever device type was |
| 8 # listed in the .android_config instead of the default device type. |
| 9 rm -f .android_config |
| 10 |
3 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 11 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 12 source $SCRIPT_DIR/android_setup.sh |
4 | 13 |
5 # remove the existing .android_config file prior to running android_setup. If | 14 if [ $(basename $0) = "android_make" ]; then |
6 # we did not remove this here then we would build for whatever device type was | 15 GYP_GENERATORS=make-android make $APP_ARGS |
7 # listed in the .android_config instead of the default device type. | 16 else |
8 if [ -f .android_config ] | 17 GYP_GENERATORS=ninja ./gyp_skia |
9 then | 18 OUT=$SKIA_OUT/${BUILDTYPE-Debug} # Defaults to Debug if BUILDTYPE isn't se
t. |
10 rm .android_config | 19 ninja -C $OUT $APP_ARGS |
| 20 ln -sf lib $OUT/lib.target # android_run_skia looks in lib.target; n
inja writes to lib. |
11 fi | 21 fi |
12 | 22 |
13 # run the config to setup the environment | 23 # Write the device id into the .android_config file. This tells |
14 source $SCRIPT_DIR/android_setup.sh | 24 # android_run_skia the last build we completed. |
15 | |
16 # write the device id into the .android_config file | |
17 echo $DEVICE_ID > .android_config | 25 echo $DEVICE_ID > .android_config |
18 | 26 |
19 for arg in ${APP_ARGS[@]} | |
20 do | |
21 if [[ "${arg}" == "--use-ccache" ]]; | |
22 then | |
23 if [[ -z "$ANDROID_MAKE_CCACHE" ]]; | |
24 then | |
25 ANDROID_MAKE_CCACHE=$(which ccache) | |
26 fi | |
27 else | |
28 makeVars=("${makeVars[@]}" "${arg}") | |
29 fi | |
30 | |
31 shift | |
32 done | |
33 | |
34 if [[ -n "$ANDROID_MAKE_CCACHE" ]]; then | |
35 $ANDROID_MAKE_CCACHE --version &> /dev/null | |
36 if [[ "$?" != "0" ]]; then | |
37 echo "Unable to find ccache!" | |
38 exit 1 | |
39 fi | |
40 fi | |
41 | |
42 make ${makeVars[@]} | |
43 if [ $? != 0 ] | |
44 then | |
45 exit 1; | |
46 fi | |
OLD | NEW |