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}" |
(...skipping 29 matching lines...) Expand all Loading... |
40 # Basic setup for all bots to run after a source tree checkout. | 40 # Basic setup for all bots to run after a source tree checkout. |
41 # Args: | 41 # Args: |
42 # $1: source root. | 42 # $1: source root. |
43 # $2 and beyond: key value pairs which are parsed by bb_parse_args. | 43 # $2 and beyond: key value pairs which are parsed by bb_parse_args. |
44 function bb_baseline_setup { | 44 function bb_baseline_setup { |
45 SRC_ROOT="$1" | 45 SRC_ROOT="$1" |
46 # Remove SRC_ROOT param | 46 # Remove SRC_ROOT param |
47 shift | 47 shift |
48 cd $SRC_ROOT | 48 cd $SRC_ROOT |
49 | 49 |
| 50 if [[ $BUILDBOT_CLOBBER ]]; then |
| 51 echo "@@@BUILD_STEP Clobber@@@" |
| 52 # Sdk key expires, delete android folder. |
| 53 # crbug.com/145860 |
| 54 rm -rf ~/.android |
| 55 rm -rf "${SRC_ROOT}"/out |
| 56 if [ -e "${SRC_ROOT}"/out ] ; then |
| 57 echo "Clobber appeared to fail? ${SRC_ROOT}/out still exists." |
| 58 echo "@@@STEP_WARNINGS@@@" |
| 59 fi |
| 60 fi |
| 61 |
50 echo "@@@BUILD_STEP Environment setup@@@" | 62 echo "@@@BUILD_STEP Environment setup@@@" |
51 bb_parse_args "$@" | 63 bb_parse_args "$@" |
52 | 64 |
53 local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) | 65 local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) |
54 if [[ $BUILDTOOL = ninja ]]; then | 66 if [[ $BUILDTOOL = ninja ]]; then |
55 export GYP_GENERATORS=ninja | 67 export GYP_GENERATORS=ninja |
56 fi | 68 fi |
57 export GOMA_DIR=/b/build/goma | 69 export GOMA_DIR=/b/build/goma |
58 . build/android/envsetup.sh | 70 . build/android/envsetup.sh |
| 71 adb kill-server |
| 72 adb start-server |
| 73 } |
59 | 74 |
| 75 function bb_compile_setup { |
60 local extra_gyp_defines="$(bb_get_json_prop "$FACTORY_PROPERTIES" \ | 76 local extra_gyp_defines="$(bb_get_json_prop "$FACTORY_PROPERTIES" \ |
61 extra_gyp_defines)" | 77 extra_gyp_defines)" |
62 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" | 78 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" |
63 if echo $extra_gyp_defines | grep -q clang; then | 79 if echo $extra_gyp_defines | grep -q clang; then |
64 unset CXX_target | 80 unset CXX_target |
65 fi | 81 fi |
66 | |
67 adb kill-server | |
68 adb start-server | |
69 | |
70 local build_path="${SRC_ROOT}/out/${BUILDTYPE}" | |
71 local landmines_triggered_path="$build_path/.landmines_triggered" | |
72 python "$SRC_ROOT/build/landmines.py" | |
73 | |
74 if [[ $BUILDBOT_CLOBBER || -f "$landmines_triggered_path" ]]; then | |
75 echo "@@@BUILD_STEP Clobber@@@" | |
76 | |
77 if [[ -z $BUILDBOT_CLOBBER ]]; then | |
78 echo "Clobbering due to triggered landmines: " | |
79 cat "$landmines_triggered_path" | |
80 else | |
81 # Also remove all the files under out/ on an explicit clobber | |
82 find "${SRC_ROOT}/out" -maxdepth 1 -type f -exec rm -f {} + | |
83 fi | |
84 | |
85 # Sdk key expires, delete android folder. | |
86 # crbug.com/145860 | |
87 rm -rf ~/.android | |
88 rm -rf "$build_path" | |
89 if [[ -e $build_path ]] ; then | |
90 echo "Clobber appeared to fail? $build_path still exists." | |
91 echo "@@@STEP_WARNINGS@@@" | |
92 fi | |
93 fi | |
94 } | |
95 | |
96 function bb_compile_setup { | |
97 bb_setup_goma_internal | 82 bb_setup_goma_internal |
98 # Should be called only after envsetup is done. | 83 # Should be called only after envsetup is done. |
99 gclient runhooks | 84 gclient runhooks |
100 } | 85 } |
101 | 86 |
102 # Setup goma. Used internally to buildbot_functions.sh. | 87 # Setup goma. Used internally to buildbot_functions.sh. |
103 function bb_setup_goma_internal { | 88 function bb_setup_goma_internal { |
104 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key | 89 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key |
105 export GOMA_COMPILER_PROXY_DAEMON_MODE=true | 90 export GOMA_COMPILER_PROXY_DAEMON_MODE=true |
106 export GOMA_COMPILER_PROXY_RPC_TIMEOUT_SECS=300 | 91 export GOMA_COMPILER_PROXY_RPC_TIMEOUT_SECS=300 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 ) | 336 ) |
352 } | 337 } |
353 | 338 |
354 # Retrieve a packed json property using python | 339 # Retrieve a packed json property using python |
355 function bb_get_json_prop { | 340 function bb_get_json_prop { |
356 local JSON="$1" | 341 local JSON="$1" |
357 local PROP="$2" | 342 local PROP="$2" |
358 | 343 |
359 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 344 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
360 } | 345 } |
OLD | NEW |