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