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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 | 145 |
146 # Stop goma. | 146 # Stop goma. |
147 function bb_stop_goma_internal { | 147 function bb_stop_goma_internal { |
148 echo "Stopping goma" | 148 echo "Stopping goma" |
149 ${GOMA_DIR}/goma_ctl.sh stop | 149 ${GOMA_DIR}/goma_ctl.sh stop |
150 } | 150 } |
151 | 151 |
152 # $@: make args. | 152 # $@: make args. |
153 # Use goma if possible; degrades to non-Goma if needed. | 153 # Use goma if possible; degrades to non-Goma if needed. |
154 function bb_goma_make { | 154 function bb_goma_make { |
155 bb_setup_goma_internal | |
156 | |
157 if [ "${GOMA_DIR}" = "" ]; then | 155 if [ "${GOMA_DIR}" = "" ]; then |
158 make -j${JOBS} "$@" | 156 make -j${JOBS} "$@" |
159 return | 157 return |
160 fi | 158 fi |
161 | 159 |
162 BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target) | |
163 HOST_CC=$GOMA_DIR/gcc | 160 HOST_CC=$GOMA_DIR/gcc |
164 HOST_CXX=$GOMA_DIR/g++ | 161 HOST_CXX=$GOMA_DIR/g++ |
165 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) | 162 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) |
166 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) | 163 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) |
167 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" | 164 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" |
168 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" | 165 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" |
169 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ | 166 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ |
170 -target 1.5 -Xmaxerrs 9999999" | 167 -target 1.5 -Xmaxerrs 9999999" |
171 | 168 |
172 command make \ | 169 command make \ |
173 -j100 \ | 170 -j100 \ |
174 -l20 \ | 171 -l20 \ |
175 HOST_CC="$HOST_CC" \ | 172 HOST_CC="$HOST_CC" \ |
176 HOST_CXX="$HOST_CXX" \ | 173 HOST_CXX="$HOST_CXX" \ |
177 TARGET_CC="$TARGET_CC" \ | 174 TARGET_CC="$TARGET_CC" \ |
178 TARGET_CXX="$TARGET_CXX" \ | 175 TARGET_CXX="$TARGET_CXX" \ |
179 CC.host="$HOST_CC" \ | 176 CC.host="$HOST_CC" \ |
180 CXX.host="$HOST_CXX" \ | 177 CXX.host="$HOST_CXX" \ |
181 CC.target="$TARGET_CC" \ | 178 CC.target="$TARGET_CC" \ |
182 CXX.target="$TARGET_CXX" \ | 179 CXX.target="$TARGET_CXX" \ |
183 LINK.target="$TARGET_CXX" \ | 180 LINK.target="$TARGET_CXX" \ |
184 COMMON_JAVAC="$COMMON_JAVAC" \ | 181 COMMON_JAVAC="$COMMON_JAVAC" \ |
185 BUILDTYPE="$BUILDTYPE" \ | 182 BUILDTYPE="$BUILDTYPE" \ |
186 "$@" | 183 "$@" |
187 | 184 |
188 local make_exit_code=$? | 185 local make_exit_code=$? |
189 bb_stop_goma_internal | |
190 return $make_exit_code | 186 return $make_exit_code |
191 } | 187 } |
192 | 188 |
189 # Build using ninja. | |
190 function bb_goma_ninja { | |
191 echo "Using ninja to build." | |
192 ninja -C out/$BUILDTYPE -j120 -l20 | |
193 } | |
194 | |
193 # Compile step | 195 # Compile step |
194 function bb_compile { | 196 function bb_compile { |
195 # This must be named 'compile', not 'Compile', for CQ interaction. | 197 # This must be named 'compile', not 'Compile', for CQ interaction. |
196 # Talk to maruel for details. | 198 # Talk to maruel for details. |
197 echo "@@@BUILD_STEP compile@@@" | 199 echo "@@@BUILD_STEP compile@@@" |
198 bb_goma_make | 200 |
201 BUILDTYPE=$(bb_get_json_prop "$FACTORY_PROPERTIES" target) | |
202 BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) | |
Isaac (away)
2012/08/29 17:29:05
Pass these variables as args rather than relying o
sivachandra
2012/08/29 19:36:49
I do not really understand you here. Are you sayin
Isaac (away)
2012/08/29 19:48:59
I'm saying bb_goma_ninja and bb_goma make are rely
sivachandra
2012/08/29 20:55:36
OK I get the idea. However, since we need to set G
| |
203 | |
204 bb_setup_goma_internal | |
205 | |
206 if [ $BUILDTOOL = "ninja" ]; then | |
207 export GYP_GENERATORS=ninja | |
Isaac (away)
2012/08/29 17:29:05
GYP_GENERATORS needs to be set to ninja before env
sivachandra
2012/08/29 19:36:49
I have moved it in patch set 3. PTAL
| |
208 bb_goma_ninja | |
209 else | |
210 bb_goma_make | |
211 fi | |
212 | |
213 bb_stop_goma_internal | |
199 } | 214 } |
200 | 215 |
201 # Experimental compile step; does not turn the tree red if it fails. | 216 # Experimental compile step; does not turn the tree red if it fails. |
202 function bb_compile_experimental { | 217 function bb_compile_experimental { |
203 # Linking DumpRenderTree appears to hang forever? | 218 # Linking DumpRenderTree appears to hang forever? |
204 EXPERIMENTAL_TARGETS="android_experimental" | 219 EXPERIMENTAL_TARGETS="android_experimental" |
205 for target in ${EXPERIMENTAL_TARGETS} ; do | 220 for target in ${EXPERIMENTAL_TARGETS} ; do |
206 echo "@@@BUILD_STEP Experimental Compile $target @@@" | 221 echo "@@@BUILD_STEP Experimental Compile $target @@@" |
207 set +e | 222 set +e |
208 bb_goma_make -k "${target}" | 223 bb_goma_make -k "${target}" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 fi | 335 fi |
321 return $license_exit_code | 336 return $license_exit_code |
322 ) | 337 ) |
323 } | 338 } |
324 | 339 |
325 # Retrieve a packed json property using python | 340 # Retrieve a packed json property using python |
326 function bb_get_json_prop { | 341 function bb_get_json_prop { |
327 local JSON="$1" | 342 local JSON="$1" |
328 local PROP="$2" | 343 local PROP="$2" |
329 | 344 |
330 python -c "import json; print json.loads('$JSON')['$PROP']" | 345 python -c "import json; print json.loads('$JSON').get('$PROP')" |
331 } | 346 } |
OLD | NEW |