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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 echo "Build cannot continue." | 77 echo "Build cannot continue." |
78 echo "@@@STEP_FAILURE@@@" | 78 echo "@@@STEP_FAILURE@@@" |
79 return 1 | 79 return 1 |
80 fi | 80 fi |
81 done | 81 done |
82 | 82 |
83 if [ ! "$BUILDBOT_CLOBBER" = "" ]; then | 83 if [ ! "$BUILDBOT_CLOBBER" = "" ]; then |
84 NEED_CLOBBER=1 | 84 NEED_CLOBBER=1 |
85 fi | 85 fi |
86 | 86 |
87 local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) | |
88 if [ $BUILDTOOL = "ninja" ]; then | |
89 export GYP_GENERATORS=ninja | |
90 fi | |
91 | |
87 . build/android/envsetup.sh | 92 . build/android/envsetup.sh |
88 | 93 |
89 if [ "$NEED_CLOBBER" -eq 1 ]; then | 94 if [ "$NEED_CLOBBER" -eq 1 ]; then |
90 echo "@@@BUILD_STEP Clobber@@@" | 95 echo "@@@BUILD_STEP Clobber@@@" |
91 rm -rf "${SRC_ROOT}"/out | 96 rm -rf "${SRC_ROOT}"/out |
92 if [ -e "${SRC_ROOT}"/out ] ; then | 97 if [ -e "${SRC_ROOT}"/out ] ; then |
93 echo "Clobber appeared to fail? ${SRC_ROOT}/out still exists." | 98 echo "Clobber appeared to fail? ${SRC_ROOT}/out still exists." |
94 echo "@@@STEP_WARNINGS@@@" | 99 echo "@@@STEP_WARNINGS@@@" |
95 fi | 100 fi |
96 fi | 101 fi |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 | 150 |
146 # Stop goma. | 151 # Stop goma. |
147 function bb_stop_goma_internal { | 152 function bb_stop_goma_internal { |
148 echo "Stopping goma" | 153 echo "Stopping goma" |
149 ${GOMA_DIR}/goma_ctl.sh stop | 154 ${GOMA_DIR}/goma_ctl.sh stop |
150 } | 155 } |
151 | 156 |
152 # $@: make args. | 157 # $@: make args. |
153 # Use goma if possible; degrades to non-Goma if needed. | 158 # Use goma if possible; degrades to non-Goma if needed. |
154 function bb_goma_make { | 159 function bb_goma_make { |
155 bb_setup_goma_internal | |
156 | |
157 if [ "${GOMA_DIR}" = "" ]; then | 160 if [ "${GOMA_DIR}" = "" ]; then |
158 make -j${JOBS} "$@" | 161 make -j${JOBS} "$@" |
159 return | 162 return |
160 fi | 163 fi |
161 | 164 |
162 BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target) | 165 local BUILDTYPE="$1" |
166 | |
163 HOST_CC=$GOMA_DIR/gcc | 167 HOST_CC=$GOMA_DIR/gcc |
164 HOST_CXX=$GOMA_DIR/g++ | 168 HOST_CXX=$GOMA_DIR/g++ |
165 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) | 169 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) |
166 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) | 170 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) |
167 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" | 171 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" |
168 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" | 172 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" |
169 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ | 173 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ |
170 -target 1.5 -Xmaxerrs 9999999" | 174 -target 1.5 -Xmaxerrs 9999999" |
171 | 175 |
172 command make \ | 176 command make \ |
173 -j100 \ | 177 -j100 \ |
174 -l20 \ | 178 -l20 \ |
175 HOST_CC="$HOST_CC" \ | 179 HOST_CC="$HOST_CC" \ |
176 HOST_CXX="$HOST_CXX" \ | 180 HOST_CXX="$HOST_CXX" \ |
177 TARGET_CC="$TARGET_CC" \ | 181 TARGET_CC="$TARGET_CC" \ |
178 TARGET_CXX="$TARGET_CXX" \ | 182 TARGET_CXX="$TARGET_CXX" \ |
179 CC.host="$HOST_CC" \ | 183 CC.host="$HOST_CC" \ |
180 CXX.host="$HOST_CXX" \ | 184 CXX.host="$HOST_CXX" \ |
181 CC.target="$TARGET_CC" \ | 185 CC.target="$TARGET_CC" \ |
182 CXX.target="$TARGET_CXX" \ | 186 CXX.target="$TARGET_CXX" \ |
183 LINK.target="$TARGET_CXX" \ | 187 LINK.target="$TARGET_CXX" \ |
184 COMMON_JAVAC="$COMMON_JAVAC" \ | 188 COMMON_JAVAC="$COMMON_JAVAC" \ |
185 BUILDTYPE="$BUILDTYPE" \ | 189 BUILDTYPE="$BUILDTYPE" \ |
186 "$@" | 190 "$@" |
187 | 191 |
188 local make_exit_code=$? | 192 local make_exit_code=$? |
189 bb_stop_goma_internal | |
190 return $make_exit_code | 193 return $make_exit_code |
191 } | 194 } |
192 | 195 |
196 # Build using ninja. | |
197 function bb_goma_ninja { | |
198 local BUILDTYPE="$1" | |
199 | |
200 echo "Using ninja to build." | |
201 ninja -C out/$BUILDTYPE -j120 -l20 | |
Yaron
2012/08/30 01:21:21
Ended up looking because Isaac asked me too. This
| |
202 } | |
203 | |
193 # Compile step | 204 # Compile step |
194 function bb_compile { | 205 function bb_compile { |
195 # This must be named 'compile', not 'Compile', for CQ interaction. | 206 # This must be named 'compile', not 'Compile', for CQ interaction. |
196 # Talk to maruel for details. | 207 # Talk to maruel for details. |
197 echo "@@@BUILD_STEP compile@@@" | 208 echo "@@@BUILD_STEP compile@@@" |
198 bb_goma_make | 209 |
210 bb_setup_goma_internal | |
211 | |
212 BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target) | |
213 BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) | |
214 if [ $BUILDTOOL = "ninja" ]; then | |
215 bb_goma_ninja $BUILDTYPE | |
216 else | |
217 bb_goma_make $BUILDTYPE | |
218 fi | |
219 | |
220 bb_stop_goma_internal | |
199 } | 221 } |
200 | 222 |
201 # Experimental compile step; does not turn the tree red if it fails. | 223 # Experimental compile step; does not turn the tree red if it fails. |
202 function bb_compile_experimental { | 224 function bb_compile_experimental { |
203 # Linking DumpRenderTree appears to hang forever? | 225 # Linking DumpRenderTree appears to hang forever? |
204 EXPERIMENTAL_TARGETS="android_experimental" | 226 EXPERIMENTAL_TARGETS="android_experimental" |
205 for target in ${EXPERIMENTAL_TARGETS} ; do | 227 for target in ${EXPERIMENTAL_TARGETS} ; do |
206 echo "@@@BUILD_STEP Experimental Compile $target @@@" | 228 echo "@@@BUILD_STEP Experimental Compile $target @@@" |
207 set +e | 229 set +e |
208 bb_goma_make -k "${target}" | 230 bb_goma_make -k "${target}" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 fi | 342 fi |
321 return $license_exit_code | 343 return $license_exit_code |
322 ) | 344 ) |
323 } | 345 } |
324 | 346 |
325 # Retrieve a packed json property using python | 347 # Retrieve a packed json property using python |
326 function bb_get_json_prop { | 348 function bb_get_json_prop { |
327 local JSON="$1" | 349 local JSON="$1" |
328 local PROP="$2" | 350 local PROP="$2" |
329 | 351 |
330 python -c "import json; print json.loads('$JSON')['$PROP']" | 352 python -c "import json; print json.loads('$JSON').get('$PROP')" |
331 } | 353 } |
OLD | NEW |