blob: ef731c1af5b9f8d1c6fb34980bcb868091237058 [file] [log] [blame]
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -07001function help() {
2cat <<EOF
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -08003Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -07004- croot: Changes directory to the top of the tree.
5- m: Makes from the top of the tree.
6- mm: Builds all of the modules in the current directory.
7- mmm: Builds all of the modules in the supplied directories.
8- cgrep: Greps on all local C/C++ files.
9- jgrep: Greps on all local Java files.
10- resgrep: Greps on all local res/*.xml files.
The Android Open Source Project88b60792009-03-03 19:28:42 -080011- godir: Go to the directory containing a file.
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070012
13Look at the source to view more functions. The complete list is:
14EOF
15 T=$(gettop)
16 local A
17 A=""
18 for i in `cat $T/build/envsetup.sh | sed -n "/^function /s/function \([a-z_]*\).*/\1/p" | sort`; do
19 A="$A $i"
20 done
21 echo $A
22}
23
24# Get the value of a build variable as an absolute path.
25function get_abs_build_var()
26{
27 T=$(gettop)
28 if [ ! "$T" ]; then
29 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
30 return
31 fi
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -080032 CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
33 make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070034}
35
36# Get the exact value of a build variable.
37function get_build_var()
38{
39 T=$(gettop)
40 if [ ! "$T" ]; then
41 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
42 return
43 fi
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -080044 CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
45 make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-$1
46}
47
48# check to see if the supplied product is one we can build
49function check_product()
50{
51 T=$(gettop)
52 if [ ! "$T" ]; then
53 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
54 return
55 fi
56 CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
57 TARGET_PRODUCT=$1 TARGET_BUILD_VARIANT= \
58 TARGET_SIMULATOR= TARGET_BUILD_TYPE= \
Joe Onoratoda12daf2010-06-09 18:18:31 -070059 TARGET_BUILD_APPS= \
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -080060 get_build_var TARGET_DEVICE > /dev/null
61 # hide successful answers, but allow the errors to show
62}
63
64VARIANT_CHOICES=(user userdebug eng)
65
66# check to see if the supplied variant is valid
67function check_variant()
68{
69 for v in ${VARIANT_CHOICES[@]}
70 do
71 if [ "$v" = "$1" ]
72 then
73 return 0
74 fi
75 done
76 return 1
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070077}
78
79function setpaths()
80{
81 T=$(gettop)
82 if [ ! "$T" ]; then
83 echo "Couldn't locate the top of the tree. Try setting TOP."
84 return
85 fi
86
87 ##################################################################
88 # #
89 # Read me before you modify this code #
90 # #
91 # This function sets ANDROID_BUILD_PATHS to what it is adding #
92 # to PATH, and the next time it is run, it removes that from #
93 # PATH. This is required so lunch can be run more than once #
94 # and still have working paths. #
95 # #
96 ##################################################################
97
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070098 # out with the old
99 if [ -n $ANDROID_BUILD_PATHS ] ; then
100 export PATH=${PATH/$ANDROID_BUILD_PATHS/}
101 fi
Jeff Hamilton4a1c70e2010-06-21 18:26:38 -0500102 if [ -n $ANDROID_PRE_BUILD_PATHS ] ; then
103 export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/}
104 fi
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700105
106 # and in with the new
107 CODE_REVIEWS=
108 prebuiltdir=$(getprebuilt)
Jing Yuada132a2010-06-16 20:17:19 -0700109 export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-eabi-4.4.3/bin
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700110 export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
111 export ANDROID_QTOOLS=$T/development/emulator/qtools
112 export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_EABI_TOOLCHAIN$CODE_REVIEWS
113 export PATH=$PATH$ANDROID_BUILD_PATHS
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800114
Jeff Hamilton4a1c70e2010-06-21 18:26:38 -0500115 unset ANDROID_JAVA_TOOLCHAIN
116 if [ -n "$JAVA_HOME" ]; then
117 export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin
118 fi
119 export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN
120 if [ -n "$ANDROID_PRE_BUILD_PATHS" ]; then
121 export PATH=$ANDROID_PRE_BUILD_PATHS:$PATH
122 fi
123
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800124 unset ANDROID_PRODUCT_OUT
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700125 export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
126 export OUT=$ANDROID_PRODUCT_OUT
127
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800128 # needed for building linux on MacOS
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700129 # TODO: fix the path
130 #export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800131
132 # needed for OProfile to post-process collected samples
133 export OPROFILE_EVENTS_DIR=$prebuiltdir/oprofile
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700134}
135
136function printconfig()
137{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800138 T=$(gettop)
139 if [ ! "$T" ]; then
140 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
141 return
142 fi
143 get_build_var report_config
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700144}
145
146function set_stuff_for_environment()
147{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800148 settitle
Jeff Hamilton4a1c70e2010-06-21 18:26:38 -0500149 set_java_home
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800150 setpaths
151 set_sequence_number
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700152
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800153 # Don't try to do preoptimization until it works better on OSX.
154 export DISABLE_DEXPREOPT=true
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700155
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800156 export ANDROID_BUILD_TOP=$(gettop)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700157}
158
159function set_sequence_number()
160{
Joe Onoratoaee4daa2010-06-23 14:03:13 -0700161 export BUILD_ENV_SEQUENCE_NUMBER=10
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700162}
163
164function settitle()
165{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800166 if [ "$STAY_OFF_MY_LAWN" = "" ]; then
Joe Onoratoda12daf2010-06-09 18:18:31 -0700167 local product=$TARGET_PRODUCT
168 local variant=$TARGET_BUILD_VARIANT
169 local apps=$TARGET_BUILD_APPS
170 if [ -z "$apps" ]; then
171 export PROMPT_COMMAND="echo -ne \"\033]0;[${product}-${variant}] ${USER}@${HOSTNAME}: ${PWD}\007\""
172 else
173 export PROMPT_COMMAND="echo -ne \"\033]0;[$apps $variant] ${USER}@${HOSTNAME}: ${PWD}\007\""
174 fi
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800175 fi
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700176}
177
178case `uname -s` in
179 Linux)
180 function choosesim()
181 {
182 echo "Build for the simulator or the device?"
183 echo " 1. Device"
184 echo " 2. Simulator"
185 echo
186
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800187 export TARGET_SIMULATOR=
188 local ANSWER
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700189 while [ -z $TARGET_SIMULATOR ]
190 do
191 echo -n "Which would you like? [1] "
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800192 if [ -z "$1" ] ; then
193 read ANSWER
194 else
195 echo $1
196 ANSWER=$1
197 fi
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700198 case $ANSWER in
199 "")
200 export TARGET_SIMULATOR=false
201 ;;
202 1)
203 export TARGET_SIMULATOR=false
204 ;;
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800205 Device)
206 export TARGET_SIMULATOR=false
207 ;;
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700208 2)
209 export TARGET_SIMULATOR=true
210 ;;
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800211 Simulator)
212 export TARGET_SIMULATOR=true
213 ;;
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700214 *)
215 echo
216 echo "I didn't understand your response. Please try again."
217 echo
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700218 ;;
219 esac
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800220 if [ -n "$1" ] ; then
221 break
222 fi
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700223 done
224
225 set_stuff_for_environment
226 }
227 ;;
228 *)
229 function choosesim()
230 {
231 echo "Only device builds are supported for" `uname -s`
232 echo " Forcing TARGET_SIMULATOR=false"
233 echo
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800234 if [ -z "$1" ]
235 then
236 echo -n "Press enter: "
237 read
238 fi
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700239
240 export TARGET_SIMULATOR=false
241 set_stuff_for_environment
242 }
243 ;;
244esac
245
246function choosetype()
247{
248 echo "Build type choices are:"
249 echo " 1. release"
250 echo " 2. debug"
251 echo
252
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800253 local DEFAULT_NUM DEFAULT_VALUE
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700254 if [ $TARGET_SIMULATOR = "false" ] ; then
255 DEFAULT_NUM=1
256 DEFAULT_VALUE=release
257 else
258 DEFAULT_NUM=2
259 DEFAULT_VALUE=debug
260 fi
261
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800262 export TARGET_BUILD_TYPE=
263 local ANSWER
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700264 while [ -z $TARGET_BUILD_TYPE ]
265 do
266 echo -n "Which would you like? ["$DEFAULT_NUM"] "
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800267 if [ -z "$1" ] ; then
268 read ANSWER
269 else
270 echo $1
271 ANSWER=$1
272 fi
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700273 case $ANSWER in
274 "")
275 export TARGET_BUILD_TYPE=$DEFAULT_VALUE
276 ;;
277 1)
278 export TARGET_BUILD_TYPE=release
279 ;;
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800280 release)
281 export TARGET_BUILD_TYPE=release
282 ;;
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700283 2)
284 export TARGET_BUILD_TYPE=debug
285 ;;
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800286 debug)
287 export TARGET_BUILD_TYPE=debug
288 ;;
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700289 *)
290 echo
291 echo "I didn't understand your response. Please try again."
292 echo
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700293 ;;
294 esac
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800295 if [ -n "$1" ] ; then
296 break
297 fi
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700298 done
299
300 set_stuff_for_environment
301}
302
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800303#
304# This function isn't really right: It chooses a TARGET_PRODUCT
305# based on the list of boards. Usually, that gets you something
306# that kinda works with a generic product, but really, you should
307# pick a product by name.
308#
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700309function chooseproduct()
310{
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700311 if [ "x$TARGET_PRODUCT" != x ] ; then
312 default_value=$TARGET_PRODUCT
313 else
314 if [ "$TARGET_SIMULATOR" = true ] ; then
315 default_value=sim
316 else
317 default_value=generic
318 fi
319 fi
320
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800321 export TARGET_PRODUCT=
322 local ANSWER
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700323 while [ -z "$TARGET_PRODUCT" ]
324 do
Joe Onorato8849aed2009-04-29 15:56:47 -0700325 echo -n "Which product would you like? [$default_value] "
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800326 if [ -z "$1" ] ; then
327 read ANSWER
328 else
329 echo $1
330 ANSWER=$1
331 fi
332
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700333 if [ -z "$ANSWER" ] ; then
334 export TARGET_PRODUCT=$default_value
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800335 else
336 if check_product $ANSWER
337 then
338 export TARGET_PRODUCT=$ANSWER
339 else
340 echo "** Not a valid product: $ANSWER"
341 fi
342 fi
343 if [ -n "$1" ] ; then
344 break
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700345 fi
346 done
347
348 set_stuff_for_environment
349}
350
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800351function choosevariant()
352{
353 echo "Variant choices are:"
354 local index=1
355 local v
356 for v in ${VARIANT_CHOICES[@]}
357 do
358 # The product name is the name of the directory containing
359 # the makefile we found, above.
360 echo " $index. $v"
361 index=$(($index+1))
362 done
363
364 local default_value=eng
365 local ANSWER
366
367 export TARGET_BUILD_VARIANT=
368 while [ -z "$TARGET_BUILD_VARIANT" ]
369 do
370 echo -n "Which would you like? [$default_value] "
371 if [ -z "$1" ] ; then
372 read ANSWER
373 else
374 echo $1
375 ANSWER=$1
376 fi
377
378 if [ -z "$ANSWER" ] ; then
379 export TARGET_BUILD_VARIANT=$default_value
380 elif (echo -n $ANSWER | grep -q -e "^[0-9][0-9]*$") ; then
381 if [ "$ANSWER" -le "${#VARIANT_CHOICES[@]}" ] ; then
382 export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-$_arrayoffset))]}
383 fi
384 else
385 if check_variant $ANSWER
386 then
387 export TARGET_BUILD_VARIANT=$ANSWER
388 else
389 echo "** Not a valid variant: $ANSWER"
390 fi
391 fi
392 if [ -n "$1" ] ; then
393 break
394 fi
395 done
396}
397
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700398function choosecombo()
399{
400 choosesim $1
401
402 echo
403 echo
404 choosetype $2
405
406 echo
407 echo
408 chooseproduct $3
409
410 echo
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800411 echo
412 choosevariant $4
413
414 echo
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700415 set_stuff_for_environment
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800416 printconfig
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700417}
418
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800419# Clear this variable. It will be built up again when the vendorsetup.sh
420# files are included at the end of this file.
421unset LUNCH_MENU_CHOICES
422function add_lunch_combo()
423{
424 local new_combo=$1
425 local c
426 for c in ${LUNCH_MENU_CHOICES[@]} ; do
427 if [ "$new_combo" = "$c" ] ; then
428 return
429 fi
430 done
431 LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo)
432}
433
434# add the default one here
435add_lunch_combo generic-eng
436
437# if we're on linux, add the simulator. There is a special case
438# in lunch to deal with the simulator
439if [ "$(uname)" = "Linux" ] ; then
440 add_lunch_combo simulator
441fi
442
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700443function print_lunch_menu()
444{
445 local uname=$(uname)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700446 echo
447 echo "You're building on" $uname
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700448 echo
449 echo "Lunch menu... pick a combo:"
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800450
451 local i=1
452 local choice
453 for choice in ${LUNCH_MENU_CHOICES[@]}
454 do
455 echo " $i. $choice"
456 i=$(($i+1))
457 done
458
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700459 echo
460}
461
462function lunch()
463{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800464 local answer
465
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700466 if [ "$1" ] ; then
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800467 answer=$1
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700468 else
469 print_lunch_menu
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800470 echo -n "Which would you like? [generic-eng] "
471 read answer
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700472 fi
473
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800474 local selection=
475
476 if [ -z "$answer" ]
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700477 then
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800478 selection=generic-eng
479 elif [ "$answer" = "simulator" ]
480 then
481 selection=simulator
482 elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")
483 then
484 if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]
485 then
486 selection=${LUNCH_MENU_CHOICES[$(($answer-$_arrayoffset))]}
487 fi
488 elif (echo -n $answer | grep -q -e "^[^\-][^\-]*-[^\-][^\-]*$")
489 then
490 selection=$answer
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700491 fi
492
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800493 if [ -z "$selection" ]
494 then
495 echo
496 echo "Invalid lunch combo: $answer"
497 return 1
498 fi
499
Joe Onoratoda12daf2010-06-09 18:18:31 -0700500 export TARGET_BUILD_APPS=
501
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800502 # special case the simulator
503 if [ "$selection" = "simulator" ]
504 then
505 export TARGET_PRODUCT=sim
506 export TARGET_BUILD_VARIANT=eng
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700507 export TARGET_SIMULATOR=true
508 export TARGET_BUILD_TYPE=debug
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800509 else
510 local product=$(echo -n $selection | sed -e "s/-.*$//")
511 check_product $product
512 if [ $? -ne 0 ]
513 then
514 echo
515 echo "** Don't have a product spec for: '$product'"
516 echo "** Do you have the right repo manifest?"
517 product=
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700518 fi
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800519
520 local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")
521 check_variant $variant
522 if [ $? -ne 0 ]
523 then
524 echo
525 echo "** Invalid variant: '$variant'"
526 echo "** Must be one of ${VARIANT_CHOICES[@]}"
527 variant=
528 fi
529
530 if [ -z "$product" -o -z "$variant" ]
531 then
532 echo
533 return 1
534 fi
535
536 export TARGET_PRODUCT=$product
537 export TARGET_BUILD_VARIANT=$variant
538 export TARGET_SIMULATOR=false
539 export TARGET_BUILD_TYPE=release
540 fi # !simulator
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700541
542 echo
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800543
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700544 set_stuff_for_environment
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800545 printconfig
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700546}
547
Joe Onoratoda12daf2010-06-09 18:18:31 -0700548# Configures the build to build unbundled apps.
549# Run tapas with one ore more app names (from LOCAL_PACKAGE_NAME)
550function tapas()
551{
552 local variant=$(echo -n $(echo $* | xargs -n 1 echo | grep -E '^(user|userdebug|eng)$'))
553 local apps=$(echo -n $(echo $* | xargs -n 1 echo | grep -E -v '^(user|userdebug|eng)$'))
554
555 if [ $(echo $variant | wc -w) -gt 1 ]; then
556 echo "tapas: Error: Multiple build variants supplied: $variant"
557 return
558 fi
559 if [ -z "$variant" ]; then
560 variant=eng
561 fi
562
563 export TARGET_PRODUCT=generic
564 export TARGET_BUILD_VARIANT=$variant
565 export TARGET_SIMULATOR=false
566 export TARGET_BUILD_TYPE=release
567 export TARGET_BUILD_APPS=$apps
568
569 set_stuff_for_environment
570 printconfig
571}
572
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700573function gettop
574{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800575 local TOPFILE=build/core/envsetup.mk
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700576 if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then
577 echo $TOP
578 else
579 if [ -f $TOPFILE ] ; then
Dan Bornsteind0b274d2009-11-24 15:48:50 -0800580 # The following circumlocution (repeated below as well) ensures
581 # that we record the true directory name and not one that is
582 # faked up with symlink names.
583 PWD= /bin/pwd
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700584 else
585 # We redirect cd to /dev/null in case it's aliased to
586 # a command that prints something as a side-effect
587 # (like pushd)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800588 local HERE=$PWD
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700589 T=
590 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
591 cd .. > /dev/null
Dan Bornsteind0b274d2009-11-24 15:48:50 -0800592 T=`PWD= /bin/pwd`
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700593 done
594 cd $HERE > /dev/null
595 if [ -f "$T/$TOPFILE" ]; then
596 echo $T
597 fi
598 fi
599 fi
600}
601
602function m()
603{
604 T=$(gettop)
605 if [ "$T" ]; then
606 make -C $T $@
607 else
608 echo "Couldn't locate the top of the tree. Try setting TOP."
609 fi
610}
611
612function findmakefile()
613{
614 TOPFILE=build/core/envsetup.mk
615 # We redirect cd to /dev/null in case it's aliased to
616 # a command that prints something as a side-effect
617 # (like pushd)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800618 local HERE=$PWD
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700619 T=
620 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
621 T=$PWD
622 if [ -f "$T/Android.mk" ]; then
623 echo $T/Android.mk
624 cd $HERE > /dev/null
625 return
626 fi
627 cd .. > /dev/null
628 done
629 cd $HERE > /dev/null
630}
631
632function mm()
633{
634 # If we're sitting in the root of the build tree, just do a
635 # normal make.
636 if [ -f build/core/envsetup.mk -a -f Makefile ]; then
637 make $@
638 else
639 # Find the closest Android.mk file.
640 T=$(gettop)
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800641 local M=$(findmakefile)
Robert Greenwalt3c794d72009-07-15 15:07:44 -0700642 # Remove the path to top as the makefilepath needs to be relative
643 local M=`echo $M|sed 's:'$T'/::'`
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700644 if [ ! "$T" ]; then
645 echo "Couldn't locate the top of the tree. Try setting TOP."
646 elif [ ! "$M" ]; then
647 echo "Couldn't locate a makefile from the current directory."
648 else
649 ONE_SHOT_MAKEFILE=$M make -C $T files $@
650 fi
651 fi
652}
653
654function mmm()
655{
656 T=$(gettop)
657 if [ "$T" ]; then
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800658 local MAKEFILE=
659 local ARGS=
660 local DIR TO_CHOP
The Android Open Source Project88b60792009-03-03 19:28:42 -0800661 local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
662 local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
663 for DIR in $DIRS ; do
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700664 DIR=`echo $DIR | sed -e 's:/$::'`
665 if [ -f $DIR/Android.mk ]; then
666 TO_CHOP=`echo $T | wc -c | tr -d ' '`
667 TO_CHOP=`expr $TO_CHOP + 1`
Gilles Debunne8a20f582010-02-17 15:56:45 -0800668 START=`PWD= /bin/pwd`
669 MFILE=`echo $START | cut -c${TO_CHOP}-`
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700670 if [ "$MFILE" = "" ] ; then
671 MFILE=$DIR/Android.mk
672 else
673 MFILE=$MFILE/$DIR/Android.mk
674 fi
675 MAKEFILE="$MAKEFILE $MFILE"
676 else
677 if [ "$DIR" = snod ]; then
678 ARGS="$ARGS snod"
679 elif [ "$DIR" = showcommands ]; then
680 ARGS="$ARGS showcommands"
681 else
682 echo "No Android.mk in $DIR."
Joe Onorato51e61822009-04-13 15:36:15 -0400683 return 1
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700684 fi
685 fi
686 done
The Android Open Source Project88b60792009-03-03 19:28:42 -0800687 ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T $DASH_ARGS files $ARGS
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700688 else
689 echo "Couldn't locate the top of the tree. Try setting TOP."
690 fi
691}
692
693function croot()
694{
695 T=$(gettop)
696 if [ "$T" ]; then
697 cd $(gettop)
698 else
699 echo "Couldn't locate the top of the tree. Try setting TOP."
700 fi
701}
702
Joe Onorato2a5d4d82009-07-30 10:23:21 -0700703function cproj()
704{
705 TOPFILE=build/core/envsetup.mk
706 # We redirect cd to /dev/null in case it's aliased to
707 # a command that prints something as a side-effect
708 # (like pushd)
709 local HERE=$PWD
710 T=
711 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
712 T=$PWD
713 if [ -f "$T/Android.mk" ]; then
714 cd $T
715 return
716 fi
717 cd .. > /dev/null
718 done
719 cd $HERE > /dev/null
720 echo "can't find Android.mk"
721}
722
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700723function pid()
724{
725 local EXE="$1"
726 if [ "$EXE" ] ; then
727 local PID=`adb shell ps | fgrep $1 | sed -e 's/[^ ]* *\([0-9]*\).*/\1/'`
728 echo "$PID"
729 else
730 echo "usage: pid name"
731 fi
732}
733
Christopher Tate744ee802009-11-12 15:33:08 -0800734# systemstack - dump the current stack trace of all threads in the system process
735# to the usual ANR traces file
736function systemstack()
737{
738 adb shell echo '""' '>>' /data/anr/traces.txt && adb shell chmod 776 /data/anr/traces.txt && adb shell kill -3 $(pid system_server)
739}
740
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700741function gdbclient()
742{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800743 local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT)
744 local OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED)
745 local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)
746 local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED)
747 local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700748 if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then
749 local EXE="$1"
750 if [ "$EXE" ] ; then
751 EXE=$1
752 else
753 EXE="app_process"
754 fi
755
756 local PORT="$2"
757 if [ "$PORT" ] ; then
758 PORT=$2
759 else
760 PORT=":5039"
761 fi
762
763 local PID
764 local PROG="$3"
765 if [ "$PROG" ] ; then
766 PID=`pid $3`
767 adb forward "tcp$PORT" "tcp$PORT"
768 adb shell gdbserver $PORT --attach $PID &
769 sleep 2
770 else
771 echo ""
772 echo "If you haven't done so already, do this first on the device:"
773 echo " gdbserver $PORT /system/bin/$EXE"
774 echo " or"
775 echo " gdbserver $PORT --attach $PID"
776 echo ""
777 fi
778
779 echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS"
780 echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS"
781 echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
782 echo >>"$OUT_ROOT/gdbclient.cmds" ""
783
784 arm-eabi-gdb -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
785 else
786 echo "Unable to determine build system output dir."
787 fi
788
789}
790
791case `uname -s` in
792 Darwin)
793 function sgrep()
794 {
Benno Leslie5ef878a2009-02-27 21:04:08 +1100795 find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml|sh|mk)' -print0 | xargs -0 grep --color -n "$@"
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700796 }
797
798 ;;
799 *)
800 function sgrep()
801 {
Benno Leslie5ef878a2009-02-27 21:04:08 +1100802 find . -type f -iregex '.*\.\(c\|h\|cpp\|S\|java\|xml\|sh\|mk\)' -print0 | xargs -0 grep --color -n "$@"
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700803 }
804 ;;
805esac
806
807function jgrep()
808{
809 find . -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
810}
811
812function cgrep()
813{
Ficus Kirkpatrick8889bdf2010-03-01 16:51:47 -0800814 find . -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700815}
816
817function resgrep()
818{
819 for dir in `find . -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
820}
821
822case `uname -s` in
823 Darwin)
824 function mgrep()
825 {
826 find -E . -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@"
827 }
828
829 function treegrep()
830 {
831 find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@"
832 }
833
834 ;;
835 *)
836 function mgrep()
837 {
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800838 find . -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@"
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700839 }
840
841 function treegrep()
842 {
843 find . -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@"
844 }
845
846 ;;
847esac
848
849function getprebuilt
850{
851 get_abs_build_var ANDROID_PREBUILTS
852}
853
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700854function tracedmdump()
855{
856 T=$(gettop)
857 if [ ! "$T" ]; then
858 echo "Couldn't locate the top of the tree. Try setting TOP."
859 return
860 fi
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800861 local prebuiltdir=$(getprebuilt)
Jack Veenstra60116fc2009-04-09 18:12:34 -0700862 local KERNEL=$T/prebuilt/android-arm/kernel/vmlinux-qemu
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700863
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800864 local TRACE=$1
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700865 if [ ! "$TRACE" ] ; then
866 echo "usage: tracedmdump tracename"
867 return
868 fi
869
Jack Veenstra60116fc2009-04-09 18:12:34 -0700870 if [ ! -r "$KERNEL" ] ; then
871 echo "Error: cannot find kernel: '$KERNEL'"
872 return
873 fi
874
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800875 local BASETRACE=$(basename $TRACE)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700876 if [ "$BASETRACE" = "$TRACE" ] ; then
877 TRACE=$ANDROID_PRODUCT_OUT/traces/$TRACE
878 fi
879
880 echo "post-processing traces..."
881 rm -f $TRACE/qtrace.dexlist
882 post_trace $TRACE
883 if [ $? -ne 0 ]; then
884 echo "***"
885 echo "*** Error: malformed trace. Did you remember to exit the emulator?"
886 echo "***"
887 return
888 fi
889 echo "generating dexlist output..."
890 /bin/ls $ANDROID_PRODUCT_OUT/system/framework/*.jar $ANDROID_PRODUCT_OUT/system/app/*.apk $ANDROID_PRODUCT_OUT/data/app/*.apk 2>/dev/null | xargs dexlist > $TRACE/qtrace.dexlist
891 echo "generating dmtrace data..."
892 q2dm -r $ANDROID_PRODUCT_OUT/symbols $TRACE $KERNEL $TRACE/dmtrace || return
893 echo "generating html file..."
894 dmtracedump -h $TRACE/dmtrace >| $TRACE/dmtrace.html || return
895 echo "done, see $TRACE/dmtrace.html for details"
896 echo "or run:"
897 echo " traceview $TRACE/dmtrace"
898}
899
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800900# communicate with a running device or emulator, set up necessary state,
901# and run the hat command.
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700902function runhat()
903{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800904 # process standard adb options
905 local adbTarget=""
906 if [ $1 = "-d" -o $1 = "-e" ]; then
907 adbTarget=$1
908 shift 1
909 elif [ $1 = "-s" ]; then
910 adbTarget="$1 $2"
911 shift 2
912 fi
913 local adbOptions=${adbTarget}
914 echo adbOptions = ${adbOptions}
915
916 # runhat options
917 local targetPid=$1
918 local outputFile=$2
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700919
920 if [ "$targetPid" = "" ]; then
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800921 echo "Usage: runhat [ -d | -e | -s serial ] target-pid [output-file]"
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700922 return
923 fi
924
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800925 # confirm hat is available
926 if [ -z $(which hat) ]; then
927 echo "hat is not available in this configuration."
928 return
929 fi
930
931 adb ${adbOptions} shell >/dev/null mkdir /data/misc
932 adb ${adbOptions} shell chmod 777 /data/misc
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700933
The Android Open Source Project88b60792009-03-03 19:28:42 -0800934 # send a SIGUSR1 to cause the hprof dump
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700935 echo "Poking $targetPid and waiting for data..."
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800936 adb ${adbOptions} shell kill -10 $targetPid
The Android Open Source Project88b60792009-03-03 19:28:42 -0800937 echo "Press enter when logcat shows \"hprof: heap dump completed\""
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700938 echo -n "> "
939 read
940
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800941 local availFiles=( $(adb ${adbOptions} shell ls /data/misc | grep '^heap-dump' | sed -e 's/.*heap-dump-/heap-dump-/' | sort -r | tr '[:space:][:cntrl:]' ' ') )
The Android Open Source Project88b60792009-03-03 19:28:42 -0800942 local devFile=/data/misc/${availFiles[0]}
943 local localFile=/tmp/$$-hprof
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700944
The Android Open Source Project88b60792009-03-03 19:28:42 -0800945 echo "Retrieving file $devFile..."
946 adb ${adbOptions} pull $devFile $localFile
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700947
The Android Open Source Project88b60792009-03-03 19:28:42 -0800948 adb ${adbOptions} shell rm $devFile
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700949
The Android Open Source Project88b60792009-03-03 19:28:42 -0800950 echo "Running hat on $localFile"
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700951 echo "View the output by pointing your browser at http://localhost:7000/"
952 echo ""
The Android Open Source Project88b60792009-03-03 19:28:42 -0800953 hat $localFile
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700954}
955
956function getbugreports()
957{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800958 local reports=(`adb shell ls /sdcard/bugreports | tr -d '\r'`)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700959
960 if [ ! "$reports" ]; then
961 echo "Could not locate any bugreports."
962 return
963 fi
964
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800965 local report
966 for report in ${reports[@]}
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700967 do
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800968 echo "/sdcard/bugreports/${report}"
969 adb pull /sdcard/bugreports/${report} ${report}
970 gunzip ${report}
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700971 done
972}
973
974function startviewserver()
975{
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -0800976 local port=4939
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700977 if [ $# -gt 0 ]; then
978 port=$1
979 fi
980 adb shell service call window 1 i32 $port
981}
982
983function stopviewserver()
984{
985 adb shell service call window 2
986}
987
988function isviewserverstarted()
989{
990 adb shell service call window 3
991}
992
993function smoketest()
994{
995 if [ ! "$ANDROID_PRODUCT_OUT" ]; then
996 echo "Couldn't locate output files. Try running 'lunch' first." >&2
997 return
998 fi
999 T=$(gettop)
1000 if [ ! "$T" ]; then
1001 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
1002 return
1003 fi
1004
1005 (cd "$T" && mmm tests/SmokeTest) &&
1006 adb uninstall com.android.smoketest > /dev/null &&
1007 adb uninstall com.android.smoketest.tests > /dev/null &&
1008 adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk &&
1009 adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTest.apk &&
1010 adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner
1011}
1012
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -08001013# simple shortcut to the runtest command
1014function runtest()
1015{
1016 T=$(gettop)
1017 if [ ! "$T" ]; then
1018 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
1019 return
1020 fi
Brett Chabot3fb149d2009-10-21 20:05:26 -07001021 ("$T"/development/testrunner/runtest.py $@)
Brett Chabot762748c2009-03-27 10:25:11 -07001022}
1023
The Android Open Source Project88b60792009-03-03 19:28:42 -08001024function godir () {
1025 if [[ -z "$1" ]]; then
1026 echo "Usage: godir <regex>"
1027 return
1028 fi
Brian Carlstromb9915a62010-01-29 16:39:32 -08001029 T=$(gettop)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001030 if [[ ! -f $T/filelist ]]; then
1031 echo -n "Creating index..."
Brian Carlstrom259e5b72010-01-30 11:45:03 -08001032 (cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001033 echo " Done"
1034 echo ""
1035 fi
1036 local lines
1037 lines=($(grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq))
1038 if [[ ${#lines[@]} = 0 ]]; then
1039 echo "Not found"
1040 return
1041 fi
1042 local pathname
1043 local choice
1044 if [[ ${#lines[@]} > 1 ]]; then
1045 while [[ -z "$pathname" ]]; do
1046 local index=1
1047 local line
1048 for line in ${lines[@]}; do
1049 printf "%6s %s\n" "[$index]" $line
1050 index=$(($index + 1))
1051 done
1052 echo
1053 echo -n "Select one: "
1054 unset choice
1055 read choice
1056 if [[ $choice -gt ${#lines[@]} || $choice -lt 1 ]]; then
1057 echo "Invalid choice"
1058 continue
1059 fi
1060 pathname=${lines[$(($choice-$_arrayoffset))]}
1061 done
1062 else
1063 # even though zsh arrays are 1-based, $foo[0] is an alias for $foo[1]
1064 pathname=${lines[0]}
1065 fi
1066 cd $T/$pathname
1067}
1068
Jeff Hamilton4a1c70e2010-06-21 18:26:38 -05001069# Force JAVA_HOME to point to java 1.6 if it isn't already set
1070function set_java_home() {
1071 if [ "$STAY_OFF_MY_LAWN" = "" ]; then
1072 if [ ! "$JAVA_HOME" ]; then
1073 case `uname -s` in
1074 Darwin)
1075 export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
1076 ;;
1077 *)
1078 export JAVA_HOME=/usr/lib/jvm/java-6-sun
1079 ;;
1080 esac
1081 fi
Jeff Hamilton04be0d82010-06-07 15:03:54 -05001082 fi
Jeff Hamilton4a1c70e2010-06-21 18:26:38 -05001083}
Jeff Hamilton04be0d82010-06-07 15:03:54 -05001084
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -08001085# determine whether arrays are zero-based (bash) or one-based (zsh)
1086_xarray=(a b c)
1087if [ -z "${_xarray[${#_xarray[@]}]}" ]
1088then
1089 _arrayoffset=1
1090else
1091 _arrayoffset=0
1092fi
1093unset _xarray
1094
1095# Execute the contents of any vendorsetup.sh files we can find.
Jean-Baptiste Queru748e6382010-03-22 10:59:08 -07001096for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/build/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null`
The Android Open Source Projectdcc08f02008-12-17 18:03:49 -08001097do
1098 echo "including $f"
1099 . $f
1100done
1101unset f