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 | |
62 echo "@@@BUILD_STEP Environment setup@@@" | 50 echo "@@@BUILD_STEP Environment setup@@@" |
63 bb_parse_args "$@" | 51 bb_parse_args "$@" |
64 | 52 |
65 local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) | 53 local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) |
66 if [[ $BUILDTOOL = ninja ]]; then | 54 if [[ $BUILDTOOL = ninja ]]; then |
67 export GYP_GENERATORS=ninja | 55 export GYP_GENERATORS=ninja |
68 fi | 56 fi |
69 export GOMA_DIR=/b/build/goma | 57 export GOMA_DIR=/b/build/goma |
70 . build/android/envsetup.sh | 58 . build/android/envsetup.sh |
71 adb kill-server | |
72 adb start-server | |
73 } | |
74 | 59 |
75 function bb_compile_setup { | |
76 local extra_gyp_defines="$(bb_get_json_prop "$FACTORY_PROPERTIES" \ | 60 local extra_gyp_defines="$(bb_get_json_prop "$FACTORY_PROPERTIES" \ |
77 extra_gyp_defines)" | 61 extra_gyp_defines)" |
78 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" | 62 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" |
79 if echo $extra_gyp_defines | grep -q clang; then | 63 if echo $extra_gyp_defines | grep -q clang; then |
80 unset CXX_target | 64 unset CXX_target |
81 fi | 65 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 { |
82 bb_setup_goma_internal | 97 bb_setup_goma_internal |
83 # Should be called only after envsetup is done. | 98 # Should be called only after envsetup is done. |
84 gclient runhooks | 99 gclient runhooks |
85 } | 100 } |
86 | 101 |
87 # Setup goma. Used internally to buildbot_functions.sh. | 102 # Setup goma. Used internally to buildbot_functions.sh. |
88 function bb_setup_goma_internal { | 103 function bb_setup_goma_internal { |
89 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key | 104 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key |
90 export GOMA_COMPILER_PROXY_DAEMON_MODE=true | 105 export GOMA_COMPILER_PROXY_DAEMON_MODE=true |
91 export GOMA_COMPILER_PROXY_RPC_TIMEOUT_SECS=300 | 106 export GOMA_COMPILER_PROXY_RPC_TIMEOUT_SECS=300 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 ) | 390 ) |
376 } | 391 } |
377 | 392 |
378 # Retrieve a packed json property using python | 393 # Retrieve a packed json property using python |
379 function bb_get_json_prop { | 394 function bb_get_json_prop { |
380 local JSON="$1" | 395 local JSON="$1" |
381 local PROP="$2" | 396 local PROP="$2" |
382 | 397 |
383 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 398 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
384 } | 399 } |
OLD | NEW |