| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash | |
| 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 | |
| 4 # found in the LICENSE file. | |
| 5 # | |
| 6 # Bash functions used by buildbot annotator scripts for the android | |
| 7 # build of chromium. Executing this script should not perform actions | |
| 8 # other than setting variables and defining of functions. | |
| 9 | |
| 10 # Number of jobs on the compile line; e.g. make -j"${JOBS}" | |
| 11 JOBS="${JOBS:-4}" | |
| 12 | |
| 13 # Parse named arguments passed into the annotator script | |
| 14 # and assign them global variable names. | |
| 15 function bb_parse_args { | |
| 16 while [[ $1 ]]; do | |
| 17 case "$1" in | |
| 18 --factory-properties=*) | |
| 19 FACTORY_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')" | |
| 20 BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target) | |
| 21 ;; | |
| 22 --build-properties=*) | |
| 23 BUILD_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')" | |
| 24 ;; | |
| 25 --slave-properties=*) | |
| 26 SLAVE_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')" | |
| 27 ;; | |
| 28 *) | |
| 29 echo "@@@STEP_WARNINGS@@@" | |
| 30 echo "Warning, unparsed input argument: '$1'" | |
| 31 ;; | |
| 32 esac | |
| 33 shift | |
| 34 done | |
| 35 } | |
| 36 | |
| 37 # Basic setup for all bots to run after a source tree checkout. | |
| 38 # Args: | |
| 39 # $1: source root. | |
| 40 # $2 and beyond: key value pairs which are parsed by bb_parse_args. | |
| 41 function bb_baseline_setup { | |
| 42 SRC_ROOT="$1" | |
| 43 # Remove SRC_ROOT param | |
| 44 shift | |
| 45 cd $SRC_ROOT | |
| 46 | |
| 47 bb_parse_args "$@" | |
| 48 | |
| 49 export GYP_GENERATORS=ninja | |
| 50 export GOMA_DIR=/b/build/goma | |
| 51 . build/android/envsetup.sh "" | |
| 52 | |
| 53 local extra_gyp_defines="$(bb_get_json_prop "$SLAVE_PROPERTIES" \ | |
| 54 extra_gyp_defines)" | |
| 55 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" | |
| 56 if echo $extra_gyp_defines | grep -qE 'clang|asan'; then | |
| 57 unset CXX_target | |
| 58 fi | |
| 59 | |
| 60 local build_path="${SRC_ROOT}/out/${BUILDTYPE}" | |
| 61 local landmines_triggered_path="$build_path/.landmines_triggered" | |
| 62 python "$SRC_ROOT/build/landmines.py" | |
| 63 | |
| 64 if [[ $BUILDBOT_CLOBBER || -f "$landmines_triggered_path" ]]; then | |
| 65 echo "@@@BUILD_STEP Clobber@@@" | |
| 66 | |
| 67 if [[ -z $BUILDBOT_CLOBBER ]]; then | |
| 68 echo "Clobbering due to triggered landmines: " | |
| 69 cat "$landmines_triggered_path" | |
| 70 else | |
| 71 # Also remove all the files under out/ on an explicit clobber | |
| 72 find "${SRC_ROOT}/out" -maxdepth 1 -type f -exec rm -f {} + | |
| 73 fi | |
| 74 | |
| 75 # Sdk key expires, delete android folder. | |
| 76 # crbug.com/145860 | |
| 77 rm -rf ~/.android | |
| 78 rm -rf "$build_path" | |
| 79 if [[ -e $build_path ]] ; then | |
| 80 echo "Clobber appeared to fail? $build_path still exists." | |
| 81 echo "@@@STEP_WARNINGS@@@" | |
| 82 fi | |
| 83 fi | |
| 84 } | |
| 85 | |
| 86 # Retrieve a packed json property using python | |
| 87 function bb_get_json_prop { | |
| 88 local JSON="$1" | |
| 89 local PROP="$2" | |
| 90 | |
| 91 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | |
| 92 } | |
| OLD | NEW |