| 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 26 matching lines...) Expand all Loading... |
| 37 # Basic setup for all bots to run after a source tree checkout. | 37 # Basic setup for all bots to run after a source tree checkout. |
| 38 # Args: | 38 # Args: |
| 39 # $1: source root. | 39 # $1: source root. |
| 40 # $2 and beyond: key value pairs which are parsed by bb_parse_args. | 40 # $2 and beyond: key value pairs which are parsed by bb_parse_args. |
| 41 function bb_baseline_setup { | 41 function bb_baseline_setup { |
| 42 SRC_ROOT="$1" | 42 SRC_ROOT="$1" |
| 43 # Remove SRC_ROOT param | 43 # Remove SRC_ROOT param |
| 44 shift | 44 shift |
| 45 cd $SRC_ROOT | 45 cd $SRC_ROOT |
| 46 | 46 |
| 47 echo "@@@BUILD_STEP Environment setup@@@" | |
| 48 bb_parse_args "$@" | 47 bb_parse_args "$@" |
| 49 | 48 |
| 50 export GYP_GENERATORS=ninja | 49 export GYP_GENERATORS=ninja |
| 51 export GOMA_DIR=/b/build/goma | 50 export GOMA_DIR=/b/build/goma |
| 52 . build/android/envsetup.sh "" | 51 . build/android/envsetup.sh "" |
| 53 | 52 |
| 54 local extra_gyp_defines="$(bb_get_json_prop "$SLAVE_PROPERTIES" \ | 53 local extra_gyp_defines="$(bb_get_json_prop "$SLAVE_PROPERTIES" \ |
| 55 extra_gyp_defines)" | 54 extra_gyp_defines)" |
| 56 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" | 55 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" |
| 57 if echo $extra_gyp_defines | grep -qE 'clang|asan'; then | 56 if echo $extra_gyp_defines | grep -qE 'clang|asan'; then |
| (...skipping 19 matching lines...) Expand all Loading... |
| 77 # crbug.com/145860 | 76 # crbug.com/145860 |
| 78 rm -rf ~/.android | 77 rm -rf ~/.android |
| 79 rm -rf "$build_path" | 78 rm -rf "$build_path" |
| 80 if [[ -e $build_path ]] ; then | 79 if [[ -e $build_path ]] ; then |
| 81 echo "Clobber appeared to fail? $build_path still exists." | 80 echo "Clobber appeared to fail? $build_path still exists." |
| 82 echo "@@@STEP_WARNINGS@@@" | 81 echo "@@@STEP_WARNINGS@@@" |
| 83 fi | 82 fi |
| 84 fi | 83 fi |
| 85 } | 84 } |
| 86 | 85 |
| 87 function bb_asan_tests_setup { | |
| 88 # Download or build the ASan runtime library. | |
| 89 ${SRC_ROOT}/tools/clang/scripts/update.sh | |
| 90 } | |
| 91 | |
| 92 # Setup goma. Used internally to buildbot_functions.sh. | |
| 93 function bb_setup_goma_internal { | |
| 94 echo "Killing old goma processes" | |
| 95 ${GOMA_DIR}/goma_ctl.sh stop || true | |
| 96 killall -9 compiler_proxy || true | |
| 97 | |
| 98 echo "Starting goma" | |
| 99 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key | |
| 100 ${GOMA_DIR}/goma_ctl.sh start | |
| 101 trap bb_stop_goma_internal SIGHUP SIGINT SIGTERM | |
| 102 } | |
| 103 | |
| 104 # Stop goma. | |
| 105 function bb_stop_goma_internal { | |
| 106 echo "Stopping goma" | |
| 107 ${GOMA_DIR}/goma_ctl.sh stop | |
| 108 } | |
| 109 | |
| 110 # Build using ninja. | |
| 111 function bb_goma_ninja { | |
| 112 echo "Using ninja to build." | |
| 113 local TARGET=$1 | |
| 114 bb_setup_goma_internal | |
| 115 ninja -C out/$BUILDTYPE -j120 -l20 $TARGET | |
| 116 bb_stop_goma_internal | |
| 117 } | |
| 118 | |
| 119 # Compile step | |
| 120 function bb_compile { | |
| 121 # This must be named 'compile' for CQ. | |
| 122 echo "@@@BUILD_STEP compile@@@" | |
| 123 gclient runhooks | |
| 124 bb_goma_ninja All | |
| 125 } | |
| 126 | |
| 127 # Experimental compile step; does not turn the tree red if it fails. | |
| 128 function bb_compile_experimental { | |
| 129 # Linking DumpRenderTree appears to hang forever? | |
| 130 EXPERIMENTAL_TARGETS="android_experimental" | |
| 131 for target in ${EXPERIMENTAL_TARGETS} ; do | |
| 132 echo "@@@BUILD_STEP Experimental Compile $target @@@" | |
| 133 set +e | |
| 134 bb_goma_ninja "${target}" | |
| 135 if [ $? -ne 0 ] ; then | |
| 136 echo "@@@STEP_WARNINGS@@@" | |
| 137 fi | |
| 138 set -e | |
| 139 done | |
| 140 } | |
| 141 | |
| 142 # Run findbugs. | |
| 143 function bb_run_findbugs { | |
| 144 echo "@@@BUILD_STEP findbugs@@@" | |
| 145 if [[ $BUILDTYPE = Release ]]; then | |
| 146 local BUILDFLAG="--release-build" | |
| 147 fi | |
| 148 bb_run_step build/android/findbugs_diff.py $BUILDFLAG | |
| 149 bb_run_step tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py \ | |
| 150 $BUILDFLAG | |
| 151 } | |
| 152 | |
| 153 # Run a buildbot step and handle failure (failure will not halt build). | |
| 154 function bb_run_step { | |
| 155 ( | |
| 156 set +e | |
| 157 "$@" | |
| 158 if [[ $? != 0 ]]; then | |
| 159 echo "@@@STEP_FAILURE@@@" | |
| 160 fi | |
| 161 ) | |
| 162 } | |
| 163 | |
| 164 # Zip and archive a build. | |
| 165 function bb_zip_build { | |
| 166 echo "@@@BUILD_STEP Zip build@@@" | |
| 167 python ../../../../scripts/slave/zip_build.py \ | |
| 168 --src-dir "$SRC_ROOT" \ | |
| 169 --build-dir "out" \ | |
| 170 --exclude-files "lib.target,gen,android_webview,jingle_unittests" \ | |
| 171 --factory-properties "$FACTORY_PROPERTIES" \ | |
| 172 --build-properties "$BUILD_PROPERTIES" | |
| 173 } | |
| 174 | |
| 175 # Download and extract a build. | |
| 176 function bb_extract_build { | |
| 177 echo "@@@BUILD_STEP Download and extract build@@@" | |
| 178 if [[ -z $FACTORY_PROPERTIES || -z $BUILD_PROPERTIES ]]; then | |
| 179 return 1 | |
| 180 fi | |
| 181 | |
| 182 # When extract_build.py downloads an unversioned build it | |
| 183 # issues a warning by exiting with large numbered return code | |
| 184 # When it fails to download it build, it exits with return | |
| 185 # code 1. We disable halt on error mode and return normally | |
| 186 # unless the python tool returns 1. | |
| 187 ( | |
| 188 set +e | |
| 189 python ../../../../scripts/slave/extract_build.py \ | |
| 190 --build-dir "$SRC_ROOT/build" \ | |
| 191 --build-output-dir "../out" \ | |
| 192 --factory-properties "$FACTORY_PROPERTIES" \ | |
| 193 --build-properties "$BUILD_PROPERTIES" | |
| 194 local extract_exit_code=$? | |
| 195 if (( $extract_exit_code > 1 )); then | |
| 196 echo "@@@STEP_WARNINGS@@@" | |
| 197 return | |
| 198 fi | |
| 199 return $extract_exit_code | |
| 200 ) | |
| 201 } | |
| 202 | |
| 203 # Runs the license checker for the WebView build. | |
| 204 # License checker may return error code 1 meaning that | |
| 205 # there are non-fatal problems (warnings). Everything | |
| 206 # above 1 is considered to be a show-stopper. | |
| 207 function bb_check_webview_licenses { | |
| 208 echo "@@@BUILD_STEP Check licenses for WebView@@@" | |
| 209 ( | |
| 210 set +e | |
| 211 cd "${SRC_ROOT}" | |
| 212 python android_webview/tools/webview_licenses.py scan | |
| 213 local licenses_exit_code=$? | |
| 214 if [[ $licenses_exit_code -eq 1 ]]; then | |
| 215 echo "@@@STEP_WARNINGS@@@" | |
| 216 elif [[ $licenses_exit_code -gt 1 ]]; then | |
| 217 echo "@@@STEP_FAILURE@@@" | |
| 218 fi | |
| 219 return 0 | |
| 220 ) | |
| 221 } | |
| 222 | |
| 223 # Retrieve a packed json property using python | 86 # Retrieve a packed json property using python |
| 224 function bb_get_json_prop { | 87 function bb_get_json_prop { |
| 225 local JSON="$1" | 88 local JSON="$1" |
| 226 local PROP="$2" | 89 local PROP="$2" |
| 227 | 90 |
| 228 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 91 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
| 229 } | 92 } |
| OLD | NEW |