3 Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment:
4 - 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.
11 - godir: Go to the directory containing a file.
13 Look at the source to view more functions. The complete list is:
18 for i in `cat $T/build/envsetup.sh | sed -n "/^function /s/function \([a-z_]*\).*/\1/p" | sort`; do
24 # Get the value of a build variable as an absolute path.
25 function get_abs_build_var()
29 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
32 CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
33 make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1
36 # Get the exact value of a build variable.
37 function get_build_var()
41 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
44 CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
45 make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-$1
48 # check to see if the supplied product is one we can build
49 function check_product()
53 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
56 CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
57 TARGET_PRODUCT=$1 TARGET_BUILD_VARIANT= \
58 TARGET_SIMULATOR= TARGET_BUILD_TYPE= \
60 get_build_var TARGET_DEVICE > /dev/null
61 # hide successful answers, but allow the errors to show
64 VARIANT_CHOICES=(user userdebug eng)
66 # check to see if the supplied variant is valid
67 function check_variant()
69 for v in ${VARIANT_CHOICES[@]}
83 echo "Couldn't locate the top of the tree. Try setting TOP."
87 ##################################################################
89 # Read me before you modify this code #
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. #
96 ##################################################################
98 # Note: on windows/cygwin, ANDROID_BUILD_PATHS will contain spaces
99 # due to "C:\Program Files" being in the path.
102 if [ -n "$ANDROID_BUILD_PATHS" ] ; then
103 export PATH=${PATH/$ANDROID_BUILD_PATHS/}
105 if [ -n "$ANDROID_PRE_BUILD_PATHS" ] ; then
106 export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/}
109 # and in with the new
111 prebuiltdir=$(getprebuilt)
112 toolchaindir=toolchain/arm-eabi-4.4.3/bin
113 # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
114 if [ -d "$prebuiltdir/$toolchaindir" ]; then
115 export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir
117 export ANDROID_EABI_TOOLCHAIN=
119 export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
120 export ANDROID_QTOOLS=$T/development/emulator/qtools
121 export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_EABI_TOOLCHAIN$CODE_REVIEWS
122 export PATH=$PATH$ANDROID_BUILD_PATHS
124 unset ANDROID_JAVA_TOOLCHAIN
125 if [ -n "$JAVA_HOME" ]; then
126 export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin
128 export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN
129 if [ -n "$ANDROID_PRE_BUILD_PATHS" ]; then
130 export PATH=$ANDROID_PRE_BUILD_PATHS:$PATH
133 unset ANDROID_PRODUCT_OUT
134 export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
135 export OUT=$ANDROID_PRODUCT_OUT
137 # needed for building linux on MacOS
139 #export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include
141 # needed for OProfile to post-process collected samples
142 export OPROFILE_EVENTS_DIR=$prebuiltdir/oprofile
145 function printconfig()
149 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
152 get_build_var report_config
155 function set_stuff_for_environment()
162 export ANDROID_BUILD_TOP=$(gettop)
165 function set_sequence_number()
167 export BUILD_ENV_SEQUENCE_NUMBER=10
172 if [ "$STAY_OFF_MY_LAWN" = "" ]; then
173 local product=$TARGET_PRODUCT
174 local variant=$TARGET_BUILD_VARIANT
175 local apps=$TARGET_BUILD_APPS
176 if [ -z "$apps" ]; then
177 export PROMPT_COMMAND="echo -ne \"\033]0;[${product}-${variant}] ${USER}@${HOSTNAME}: ${PWD}\007\""
179 export PROMPT_COMMAND="echo -ne \"\033]0;[$apps $variant] ${USER}@${HOSTNAME}: ${PWD}\007\""
184 function addcompletions()
188 # Keep us from trying to run in something that isn't bash.
189 if [ -z "${BASH_VERSION}" ]; then
193 # Keep us from trying to run in bash that's too old.
194 if [ ${BASH_VERSINFO[0]} -lt 3 ]; then
198 dir="sdk/bash_completion"
199 if [ -d ${dir} ]; then
200 for f in ${dir}/[a-z]*.bash; do
211 echo "Build for the simulator or the device?"
216 export TARGET_SIMULATOR=
218 while [ -z $TARGET_SIMULATOR ]
220 echo -n "Which would you like? [1] "
221 if [ -z "$1" ] ; then
229 export TARGET_SIMULATOR=false
232 export TARGET_SIMULATOR=false
235 export TARGET_SIMULATOR=false
238 export TARGET_SIMULATOR=true
241 export TARGET_SIMULATOR=true
245 echo "I didn't understand your response. Please try again."
249 if [ -n "$1" ] ; then
254 set_stuff_for_environment
260 echo "Only device builds are supported for" `uname -s`
261 echo " Forcing TARGET_SIMULATOR=false"
265 echo -n "Press enter: "
269 export TARGET_SIMULATOR=false
270 set_stuff_for_environment
275 function choosetype()
277 echo "Build type choices are:"
282 local DEFAULT_NUM DEFAULT_VALUE
283 if [ $TARGET_SIMULATOR = "false" ] ; then
285 DEFAULT_VALUE=release
291 export TARGET_BUILD_TYPE=
293 while [ -z $TARGET_BUILD_TYPE ]
295 echo -n "Which would you like? ["$DEFAULT_NUM"] "
296 if [ -z "$1" ] ; then
304 export TARGET_BUILD_TYPE=$DEFAULT_VALUE
307 export TARGET_BUILD_TYPE=release
310 export TARGET_BUILD_TYPE=release
313 export TARGET_BUILD_TYPE=debug
316 export TARGET_BUILD_TYPE=debug
320 echo "I didn't understand your response. Please try again."
324 if [ -n "$1" ] ; then
329 set_stuff_for_environment
333 # This function isn't really right: It chooses a TARGET_PRODUCT
334 # based on the list of boards. Usually, that gets you something
335 # that kinda works with a generic product, but really, you should
336 # pick a product by name.
338 function chooseproduct()
340 if [ "x$TARGET_PRODUCT" != x ] ; then
341 default_value=$TARGET_PRODUCT
343 if [ "$TARGET_SIMULATOR" = true ] ; then
350 export TARGET_PRODUCT=
352 while [ -z "$TARGET_PRODUCT" ]
354 echo -n "Which product would you like? [$default_value] "
355 if [ -z "$1" ] ; then
362 if [ -z "$ANSWER" ] ; then
363 export TARGET_PRODUCT=$default_value
365 if check_product $ANSWER
367 export TARGET_PRODUCT=$ANSWER
369 echo "** Not a valid product: $ANSWER"
372 if [ -n "$1" ] ; then
377 set_stuff_for_environment
380 function choosevariant()
382 echo "Variant choices are:"
385 for v in ${VARIANT_CHOICES[@]}
387 # The product name is the name of the directory containing
388 # the makefile we found, above.
393 local default_value=eng
396 export TARGET_BUILD_VARIANT=
397 while [ -z "$TARGET_BUILD_VARIANT" ]
399 echo -n "Which would you like? [$default_value] "
400 if [ -z "$1" ] ; then
407 if [ -z "$ANSWER" ] ; then
408 export TARGET_BUILD_VARIANT=$default_value
409 elif (echo -n $ANSWER | grep -q -e "^[0-9][0-9]*$") ; then
410 if [ "$ANSWER" -le "${#VARIANT_CHOICES[@]}" ] ; then
411 export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-1))]}
414 if check_variant $ANSWER
416 export TARGET_BUILD_VARIANT=$ANSWER
418 echo "** Not a valid variant: $ANSWER"
421 if [ -n "$1" ] ; then
427 function choosecombo()
444 set_stuff_for_environment
448 # Clear this variable. It will be built up again when the vendorsetup.sh
449 # files are included at the end of this file.
450 unset LUNCH_MENU_CHOICES
451 function add_lunch_combo()
455 for c in ${LUNCH_MENU_CHOICES[@]} ; do
456 if [ "$new_combo" = "$c" ] ; then
460 LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo)
463 # add the default one here
464 add_lunch_combo full-eng
465 add_lunch_combo full_x86-eng
466 add_lunch_combo vbox_x86-eng
468 function print_lunch_menu()
472 echo "You're building on" $uname
474 echo "Lunch menu... pick a combo:"
478 for choice in ${LUNCH_MENU_CHOICES[@]}
495 echo -n "Which would you like? [full-eng] "
504 elif [ "$answer" = "simulator" ]
507 elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")
509 if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]
511 selection=${LUNCH_MENU_CHOICES[$(($answer-1))]}
513 elif (echo -n $answer | grep -q -e "^[^\-][^\-]*-[^\-][^\-]*$")
518 if [ -z "$selection" ]
521 echo "Invalid lunch combo: $answer"
525 export TARGET_BUILD_APPS=
527 # special case the simulator
528 if [ "$selection" = "simulator" ]
530 export TARGET_PRODUCT=sim
531 export TARGET_BUILD_VARIANT=eng
532 export TARGET_SIMULATOR=true
533 export TARGET_BUILD_TYPE=debug
535 local product=$(echo -n $selection | sed -e "s/-.*$//")
536 check_product $product
540 echo "** Don't have a product spec for: '$product'"
541 echo "** Do you have the right repo manifest?"
545 local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")
546 check_variant $variant
550 echo "** Invalid variant: '$variant'"
551 echo "** Must be one of ${VARIANT_CHOICES[@]}"
555 if [ -z "$product" -o -z "$variant" ]
561 export TARGET_PRODUCT=$product
562 export TARGET_BUILD_VARIANT=$variant
563 export TARGET_SIMULATOR=false
564 export TARGET_BUILD_TYPE=release
569 set_stuff_for_environment
573 # Configures the build to build unbundled apps.
574 # Run tapas with one ore more app names (from LOCAL_PACKAGE_NAME)
577 local variant=$(echo -n $(echo $* | xargs -n 1 echo | grep -E '^(user|userdebug|eng)$'))
578 local apps=$(echo -n $(echo $* | xargs -n 1 echo | grep -E -v '^(user|userdebug|eng)$'))
580 if [ $(echo $variant | wc -w) -gt 1 ]; then
581 echo "tapas: Error: Multiple build variants supplied: $variant"
584 if [ -z "$variant" ]; then
587 if [ -z "$apps" ]; then
591 export TARGET_PRODUCT=full
592 export TARGET_BUILD_VARIANT=$variant
593 export TARGET_SIMULATOR=false
594 export TARGET_BUILD_TYPE=release
595 export TARGET_BUILD_APPS=$apps
597 set_stuff_for_environment
603 local TOPFILE=build/core/envsetup.mk
604 if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then
607 if [ -f $TOPFILE ] ; then
608 # The following circumlocution (repeated below as well) ensures
609 # that we record the true directory name and not one that is
610 # faked up with symlink names.
613 # We redirect cd to /dev/null in case it's aliased to
614 # a command that prints something as a side-effect
618 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
623 if [ -f "$T/$TOPFILE" ]; then
636 echo "Couldn't locate the top of the tree. Try setting TOP."
640 function findmakefile()
642 TOPFILE=build/core/envsetup.mk
643 # We redirect cd to /dev/null in case it's aliased to
644 # a command that prints something as a side-effect
648 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
650 if [ -f "$T/Android.mk" ]; then
662 # If we're sitting in the root of the build tree, just do a
664 if [ -f build/core/envsetup.mk -a -f Makefile ]; then
667 # Find the closest Android.mk file.
669 local M=$(findmakefile)
670 # Remove the path to top as the makefilepath needs to be relative
671 local M=`echo $M|sed 's:'$T'/::'`
673 echo "Couldn't locate the top of the tree. Try setting TOP."
674 elif [ ! "$M" ]; then
675 echo "Couldn't locate a makefile from the current directory."
677 ONE_SHOT_MAKEFILE=$M make -C $T all_modules $@
689 local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
690 local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
691 for DIR in $DIRS ; do
692 DIR=`echo $DIR | sed -e 's:/$::'`
693 if [ -f $DIR/Android.mk ]; then
694 TO_CHOP=`(cd -P -- $T && pwd -P) | wc -c | tr -d ' '`
695 TO_CHOP=`expr $TO_CHOP + 1`
696 START=`PWD= /bin/pwd`
697 MFILE=`echo $START | cut -c${TO_CHOP}-`
698 if [ "$MFILE" = "" ] ; then
699 MFILE=$DIR/Android.mk
701 MFILE=$MFILE/$DIR/Android.mk
703 MAKEFILE="$MAKEFILE $MFILE"
705 if [ "$DIR" = snod ]; then
707 elif [ "$DIR" = showcommands ]; then
708 ARGS="$ARGS showcommands"
709 elif [ "$DIR" = dist ]; then
712 echo "No Android.mk in $DIR."
717 ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T $DASH_ARGS all_modules $ARGS
719 echo "Couldn't locate the top of the tree. Try setting TOP."
729 echo "Couldn't locate the top of the tree. Try setting TOP."
735 TOPFILE=build/core/envsetup.mk
736 # We redirect cd to /dev/null in case it's aliased to
737 # a command that prints something as a side-effect
741 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
743 if [ -f "$T/Android.mk" ]; then
750 echo "can't find Android.mk"
757 local PID=`adb shell ps | fgrep $1 | sed -e 's/[^ ]* *\([0-9]*\).*/\1/'`
760 echo "usage: pid name"
764 # systemstack - dump the current stack trace of all threads in the system process
765 # to the usual ANR traces file
766 function systemstack()
768 adb shell echo '""' '>>' /data/anr/traces.txt && adb shell chmod 776 /data/anr/traces.txt && adb shell kill -3 $(pid system_server)
773 local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT)
774 local OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED)
775 local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)
776 local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED)
777 local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS)
778 if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then
787 if [ "$PORT" ] ; then
795 if [ "$PROG" ] ; then
797 adb forward "tcp$PORT" "tcp$PORT"
798 adb shell gdbserver $PORT --attach $PID &
802 echo "If you haven't done so already, do this first on the device:"
803 echo " gdbserver $PORT /system/bin/$EXE"
805 echo " gdbserver $PORT --attach $PID"
809 echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS"
810 echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS"
811 echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
812 echo >>"$OUT_ROOT/gdbclient.cmds" ""
814 arm-eabi-gdb -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
816 echo "Unable to determine build system output dir."
825 find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml|sh|mk)' -print0 | xargs -0 grep --color -n "$@"
832 find . -type f -iregex '.*\.\(c\|h\|cpp\|S\|java\|xml\|sh\|mk\)' -print0 | xargs -0 grep --color -n "$@"
839 find . -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
844 find . -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
849 for dir in `find . -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
856 find -E . -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@"
861 find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@"
868 find . -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@"
873 find . -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@"
881 get_abs_build_var ANDROID_PREBUILTS
884 function tracedmdump()
888 echo "Couldn't locate the top of the tree. Try setting TOP."
891 local prebuiltdir=$(getprebuilt)
892 local KERNEL=$T/prebuilt/android-arm/kernel/vmlinux-qemu
895 if [ ! "$TRACE" ] ; then
896 echo "usage: tracedmdump tracename"
900 if [ ! -r "$KERNEL" ] ; then
901 echo "Error: cannot find kernel: '$KERNEL'"
905 local BASETRACE=$(basename $TRACE)
906 if [ "$BASETRACE" = "$TRACE" ] ; then
907 TRACE=$ANDROID_PRODUCT_OUT/traces/$TRACE
910 echo "post-processing traces..."
911 rm -f $TRACE/qtrace.dexlist
913 if [ $? -ne 0 ]; then
915 echo "*** Error: malformed trace. Did you remember to exit the emulator?"
919 echo "generating dexlist output..."
920 /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
921 echo "generating dmtrace data..."
922 q2dm -r $ANDROID_PRODUCT_OUT/symbols $TRACE $KERNEL $TRACE/dmtrace || return
923 echo "generating html file..."
924 dmtracedump -h $TRACE/dmtrace >| $TRACE/dmtrace.html || return
925 echo "done, see $TRACE/dmtrace.html for details"
927 echo " traceview $TRACE/dmtrace"
930 # communicate with a running device or emulator, set up necessary state,
931 # and run the hat command.
934 # process standard adb options
936 if [ "$1" = "-d" -o "$1" = "-e" ]; then
939 elif [ "$1" = "-s" ]; then
943 local adbOptions=${adbTarget}
944 echo adbOptions = ${adbOptions}
950 if [ "$targetPid" = "" ]; then
951 echo "Usage: runhat [ -d | -e | -s serial ] target-pid [output-file]"
955 # confirm hat is available
956 if [ -z $(which hat) ]; then
957 echo "hat is not available in this configuration."
961 adb ${adbOptions} shell >/dev/null mkdir /data/misc
962 adb ${adbOptions} shell chmod 777 /data/misc
964 # send a SIGUSR1 to cause the hprof dump
965 echo "Poking $targetPid and waiting for data..."
966 adb ${adbOptions} shell kill -10 $targetPid
967 echo "Press enter when logcat shows \"hprof: heap dump completed\""
971 local availFiles=( $(adb ${adbOptions} shell ls /data/misc | grep '^heap-dump' | sed -e 's/.*heap-dump-/heap-dump-/' | sort -r | tr '[:space:][:cntrl:]' ' ') )
972 local devFile=/data/misc/${availFiles[0]}
973 local localFile=/tmp/$$-hprof
975 echo "Retrieving file $devFile..."
976 adb ${adbOptions} pull $devFile $localFile
978 adb ${adbOptions} shell rm $devFile
980 echo "Running hat on $localFile"
981 echo "View the output by pointing your browser at http://localhost:7000/"
986 function getbugreports()
988 local reports=(`adb shell ls /sdcard/bugreports | tr -d '\r'`)
990 if [ ! "$reports" ]; then
991 echo "Could not locate any bugreports."
996 for report in ${reports[@]}
998 echo "/sdcard/bugreports/${report}"
999 adb pull /sdcard/bugreports/${report} ${report}
1004 function startviewserver()
1007 if [ $# -gt 0 ]; then
1010 adb shell service call window 1 i32 $port
1013 function stopviewserver()
1015 adb shell service call window 2
1018 function isviewserverstarted()
1020 adb shell service call window 3
1023 function smoketest()
1025 if [ ! "$ANDROID_PRODUCT_OUT" ]; then
1026 echo "Couldn't locate output files. Try running 'lunch' first." >&2
1031 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
1035 (cd "$T" && mmm tests/SmokeTest) &&
1036 adb uninstall com.android.smoketest > /dev/null &&
1037 adb uninstall com.android.smoketest.tests > /dev/null &&
1038 adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk &&
1039 adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTest.apk &&
1040 adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner
1043 # simple shortcut to the runtest command
1048 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
1051 ("$T"/development/testrunner/runtest.py $@)
1055 if [[ -z "$1" ]]; then
1056 echo "Usage: godir <regex>"
1060 if [[ ! -f $T/filelist ]]; then
1061 echo -n "Creating index..."
1062 (cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist)
1067 lines=($(grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq))
1068 if [[ ${#lines[@]} = 0 ]]; then
1074 if [[ ${#lines[@]} > 1 ]]; then
1075 while [[ -z "$pathname" ]]; do
1078 for line in ${lines[@]}; do
1079 printf "%6s %s\n" "[$index]" $line
1080 index=$(($index + 1))
1083 echo -n "Select one: "
1086 if [[ $choice -gt ${#lines[@]} || $choice -lt 1 ]]; then
1087 echo "Invalid choice"
1090 pathname=${lines[$(($choice-1))]}
1093 pathname=${lines[0]}
1098 # Force JAVA_HOME to point to java 1.6 if it isn't already set
1099 function set_java_home() {
1100 if [ ! "$JAVA_HOME" ]; then
1103 export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
1106 export JAVA_HOME=/usr/lib/jvm/java-6-sun
1112 if [ "x$SHELL" != "x/bin/bash" ]; then
1113 case `ps -o command -p $$` in
1117 echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
1122 # Execute the contents of any vendorsetup.sh files we can find.
1123 for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null`