| Index: build/android/buildbot/buildbot_functions.sh
|
| diff --git a/build/android/buildbot/buildbot_functions.sh b/build/android/buildbot/buildbot_functions.sh
|
| index 25e89c40a82f98eaf69a4cf47b791dd935c712bd..b1e74b143cd7bfc04c00f7c08b7c4986351e76be 100755
|
| --- a/build/android/buildbot/buildbot_functions.sh
|
| +++ b/build/android/buildbot/buildbot_functions.sh
|
| @@ -18,6 +18,7 @@ function bb_parse_args {
|
| --factory-properties=*)
|
| FACTORY_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')"
|
| BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target)
|
| + BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool)
|
| ;;
|
| --build-properties=*)
|
| BUILD_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')"
|
| @@ -37,6 +38,71 @@ function bb_force_bot_green_and_exit {
|
| exit 0
|
| }
|
|
|
| +# Check for landmines which might clobber the build. Will create a new annotator
|
| +# step for the clobber if one is required.
|
| +#
|
| +# As a side effect, creates "$2/.landmines"
|
| +#
|
| +# Args:
|
| +# $1: source root
|
| +# $2: output root
|
| +# Retval:
|
| +# 0 if landmines are tripped for this build and we need clobber OR
|
| +# clobber was requested via $BUILDBOT_CLOBBER
|
| +# 1 if landmines are dormant
|
| +function bb_check_clobber {
|
| + local src_root="$1"
|
| + local out_dir="$2"
|
| +
|
| + local ret=1
|
| +
|
| + if [[ $BUILDBOT_CLOBBER ]]
|
| + then
|
| + echo "@@@BUILD_STEP Clobber@@@"
|
| + echo "Clobber explicitly requested"
|
| + ret=0
|
| + else
|
| + local landmines_path="$out_dir/.landmines"
|
| + local landmines_script="$src_root/build/landmines.py"
|
| + [[ ! -x "$landmines_script" ]] || return 1
|
| +
|
| + local new_landmines=$(mktemp)
|
| +
|
| + python "$landmines_script" >> "$new_landmines" <<EOF
|
| + {
|
| + "target": "$BUILDTYPE",
|
| + "distributor": "goma",
|
| + "platform": "android",
|
| + "builder": "$BUILDTOOL"
|
| + }
|
| +EOF
|
| +
|
| + if [[ ! -f "$landmines_path" ]]
|
| + then
|
| + mkdir -p "$(dirname "$landmines_path")"
|
| + mv "$new_landmines" "$landmines_path"
|
| + else
|
| + local diff_output=$(mktemp)
|
| + diff -U 0 --label "old_landmines $(stat -c "%z" "$landmines_path")" \
|
| + "$landmines_path" \
|
| + --label "new_landmines $(stat -c "%z" "$new_landmines")" \
|
| + "$new_landmines" > "$diff_output"
|
| + if [[ $? != 0 ]]
|
| + then
|
| + echo "@@@BUILD_STEP Clobber@@@"
|
| + echo "Landmines tripped! Clobbering the build! Reasons for clobber:"
|
| + cat "$diff_output"
|
| + ret=0
|
| + fi
|
| + rm -f "$diff_output"
|
| + fi
|
| +
|
| + rm -f "$new_landmines"
|
| + fi
|
| +
|
| + return $ret
|
| +}
|
| +
|
| # Basic setup for all bots to run after a source tree checkout.
|
| # Args:
|
| # $1: source root.
|
| @@ -47,8 +113,11 @@ function bb_baseline_setup {
|
| shift
|
| cd $SRC_ROOT
|
|
|
| - if [[ $BUILDBOT_CLOBBER ]]; then
|
| - echo "@@@BUILD_STEP Clobber@@@"
|
| + echo "@@@BUILD_STEP Parse args@@@"
|
| + bb_parse_args "$@"
|
| +
|
| + if bb_check_clobber "$SRC_ROOT" "$SRC_ROOT/out/$BUILDTYPE"
|
| + then
|
| # Sdk key expires, delete android folder.
|
| # crbug.com/145860
|
| rm -rf ~/.android
|
| @@ -60,9 +129,6 @@ function bb_baseline_setup {
|
| fi
|
|
|
| echo "@@@BUILD_STEP Environment setup@@@"
|
| - bb_parse_args "$@"
|
| -
|
| - local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool)
|
| if [[ $BUILDTOOL = ninja ]]; then
|
| export GYP_GENERATORS=ninja
|
| fi
|
| @@ -155,7 +221,6 @@ function bb_compile {
|
| # Talk to maruel for details.
|
| echo "@@@BUILD_STEP compile@@@"
|
|
|
| - BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool)
|
| if [[ $BUILDTOOL = ninja ]]; then
|
| bb_goma_ninja All
|
| else
|
|
|