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