OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 # Bash functions used by buildbot annotator scripts for the android | 6 # Bash functions used by buildbot annotator scripts for the android |
7 # build of chromium. Executing this script should not perform actions | 7 # build of chromium. Executing this script should not perform actions |
8 # other than setting variables and defining of functions. | 8 # other than setting variables and defining of functions. |
9 | 9 |
10 # Number of jobs on the compile line; e.g. make -j"${JOBS}" | 10 # Number of jobs on the compile line; e.g. make -j"${JOBS}" |
11 JOBS="${JOBS:-4}" | 11 JOBS="${JOBS:-4}" |
12 | 12 |
13 # Clobber build? Overridden by bots with BUILDBOT_CLOBBER. | |
14 NEED_CLOBBER="${NEED_CLOBBER:-0}" | |
15 | |
16 | |
17 # Parse named arguments passed into the annotator script | 13 # Parse named arguments passed into the annotator script |
18 # and assign them global variable names. | 14 # and assign them global variable names. |
19 function bb_parse_args { | 15 function bb_parse_args { |
20 while [[ $1 ]]; do | 16 while [[ $1 ]]; do |
21 case "$1" in | 17 case "$1" in |
22 --factory-properties=*) | 18 --factory-properties=*) |
23 FACTORY_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')" | 19 FACTORY_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')" |
24 BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target) | 20 BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target) |
25 ;; | 21 ;; |
26 --build-properties=*) | 22 --build-properties=*) |
(...skipping 16 matching lines...) Expand all Loading... |
43 | 39 |
44 function bb_run_gclient_hooks { | 40 function bb_run_gclient_hooks { |
45 gclient runhooks | 41 gclient runhooks |
46 } | 42 } |
47 | 43 |
48 # Basic setup for all bots to run after a source tree checkout. | 44 # Basic setup for all bots to run after a source tree checkout. |
49 # Args: | 45 # Args: |
50 # $1: source root. | 46 # $1: source root. |
51 # $2 and beyond: key value pairs which are parsed by bb_parse_args. | 47 # $2 and beyond: key value pairs which are parsed by bb_parse_args. |
52 function bb_baseline_setup { | 48 function bb_baseline_setup { |
53 echo "@@@BUILD_STEP Environment setup@@@" | |
54 SRC_ROOT="$1" | 49 SRC_ROOT="$1" |
55 # Remove SRC_ROOT param | 50 # Remove SRC_ROOT param |
56 shift | 51 shift |
| 52 cd $SRC_ROOT |
57 | 53 |
58 bb_parse_args "$@" | 54 if [[ $BUILDBOT_CLOBBER ]]; then |
59 | |
60 cd $SRC_ROOT | |
61 if [ ! "$BUILDBOT_CLOBBER" = "" ]; then | |
62 NEED_CLOBBER=1 | |
63 fi | |
64 | |
65 | |
66 local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) | |
67 if [[ $BUILDTOOL = ninja ]]; then | |
68 export GYP_GENERATORS=ninja | |
69 fi | |
70 | |
71 if [ "$NEED_CLOBBER" -eq 1 ]; then | |
72 echo "@@@BUILD_STEP Clobber@@@" | 55 echo "@@@BUILD_STEP Clobber@@@" |
73 # Sdk key expires, delete android folder. | 56 # Sdk key expires, delete android folder. |
74 # crbug.com/145860 | 57 # crbug.com/145860 |
75 rm -rf ~/.android | 58 rm -rf ~/.android |
76 rm -rf "${SRC_ROOT}"/out | 59 rm -rf "${SRC_ROOT}"/out |
77 if [ -e "${SRC_ROOT}"/out ] ; then | 60 if [ -e "${SRC_ROOT}"/out ] ; then |
78 echo "Clobber appeared to fail? ${SRC_ROOT}/out still exists." | 61 echo "Clobber appeared to fail? ${SRC_ROOT}/out still exists." |
79 echo "@@@STEP_WARNINGS@@@" | 62 echo "@@@STEP_WARNINGS@@@" |
80 fi | 63 fi |
81 fi | 64 fi |
82 | 65 |
| 66 echo "@@@BUILD_STEP Environment setup@@@" |
| 67 bb_parse_args "$@" |
| 68 |
| 69 local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) |
| 70 if [[ $BUILDTOOL = ninja ]]; then |
| 71 export GYP_GENERATORS=ninja |
| 72 fi |
83 bb_setup_goma_internal | 73 bb_setup_goma_internal |
84 . build/android/envsetup.sh | 74 . build/android/envsetup.sh |
85 export GYP_DEFINES+=" fastbuild=1" | 75 export GYP_DEFINES+=" fastbuild=1" |
86 export GYP_DEFINES+=" $(bb_get_json_prop "$FACTORY_PROPERTIES" \ | 76 export GYP_DEFINES+=" $(bb_get_json_prop "$FACTORY_PROPERTIES" \ |
87 extra_gyp_defines)" | 77 extra_gyp_defines)" |
88 # Should be called only after envsetup is done. | 78 # Should be called only after envsetup is done. |
89 bb_run_gclient_hooks | 79 bb_run_gclient_hooks |
90 } | 80 } |
91 | 81 |
92 | 82 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 ) | 296 ) |
307 } | 297 } |
308 | 298 |
309 # Retrieve a packed json property using python | 299 # Retrieve a packed json property using python |
310 function bb_get_json_prop { | 300 function bb_get_json_prop { |
311 local JSON="$1" | 301 local JSON="$1" |
312 local PROP="$2" | 302 local PROP="$2" |
313 | 303 |
314 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 304 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
315 } | 305 } |
OLD | NEW |