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 (cd $T; 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 \
58 TARGET_BUILD_VARIANT= \
61 get_build_var TARGET_DEVICE > /dev/null
62 # hide successful answers, but allow the errors to show
65 VARIANT_CHOICES=(user userdebug eng)
67 # check to see if the supplied variant is valid
68 function check_variant()
70 for v in ${VARIANT_CHOICES[@]}
84 echo "Couldn't locate the top of the tree. Try setting TOP."
88 ##################################################################
90 # Read me before you modify this code #
92 # This function sets ANDROID_BUILD_PATHS to what it is adding #
93 # to PATH, and the next time it is run, it removes that from #
94 # PATH. This is required so lunch can be run more than once #
95 # and still have working paths. #
97 ##################################################################
99 # Note: on windows/cygwin, ANDROID_BUILD_PATHS will contain spaces
100 # due to "C:\Program Files" being in the path.
103 if [ -n "$ANDROID_BUILD_PATHS" ] ; then
104 export PATH=${PATH/$ANDROID_BUILD_PATHS/}
106 if [ -n "$ANDROID_PRE_BUILD_PATHS" ] ; then
107 export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/}
108 # strip trailing ':', if any
109 export PATH=${PATH/%:/}
112 # and in with the new
114 prebuiltdir=$(getprebuilt)
115 gccprebuiltdir=$(get_abs_build_var ANDROID_GCC_PREBUILTS)
117 # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
118 export ANDROID_EABI_TOOLCHAIN=
119 local ARCH=$(get_build_var TARGET_ARCH)
121 x86) toolchaindir=x86/i686-android-linux-4.4.3/bin
123 arm) toolchaindir=arm/arm-linux-androideabi-4.6/bin
126 echo "Can't find toolchain for unknown architecture: $ARCH"
127 toolchaindir=xxxxxxxxx
130 if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
131 export ANDROID_EABI_TOOLCHAIN=$gccprebuiltdir/$toolchaindir
134 export ARM_EABI_TOOLCHAIN=
136 x86) toolchaindir=x86/i686-eabi-4.4.3/bin
138 arm) toolchaindir=arm/arm-eabi-4.6/bin
141 echo "Can't find toolchain for unknown architecture: $ARCH"
142 toolchaindir=xxxxxxxxx
145 if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
146 export ARM_EABI_TOOLCHAIN=$gccprebuiltdir/$toolchaindir
149 export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
150 export ANDROID_QTOOLS=$T/development/emulator/qtools
151 export ANDROID_DEV_SCRIPTS=$T/development/scripts
152 export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ARM_EABI_TOOLCHAIN$CODE_REVIEWS:$ANDROID_DEV_SCRIPTS
153 export PATH=$PATH$ANDROID_BUILD_PATHS
155 unset ANDROID_JAVA_TOOLCHAIN
156 unset ANDROID_PRE_BUILD_PATHS
157 if [ -n "$JAVA_HOME" ]; then
158 export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin
159 export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN:
160 export PATH=$ANDROID_PRE_BUILD_PATHS$PATH
163 unset ANDROID_PRODUCT_OUT
164 export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
165 export OUT=$ANDROID_PRODUCT_OUT
167 unset ANDROID_HOST_OUT
168 export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT)
170 # needed for processing samples collected by perf counters
171 unset OPROFILE_EVENTS_DIR
172 export OPROFILE_EVENTS_DIR=$T/external/oprofile/events
174 # needed for building linux on MacOS
176 #export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include
179 function printconfig()
183 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
186 get_build_var report_config
189 function set_stuff_for_environment()
196 export ANDROID_BUILD_TOP=$(gettop)
199 function set_sequence_number()
201 export BUILD_ENV_SEQUENCE_NUMBER=10
206 if [ "$STAY_OFF_MY_LAWN" = "" ]; then
207 local product=$TARGET_PRODUCT
208 local variant=$TARGET_BUILD_VARIANT
209 local apps=$TARGET_BUILD_APPS
210 if [ -z "$apps" ]; then
211 export PROMPT_COMMAND="echo -ne \"\033]0;[${product}-${variant}] ${USER}@${HOSTNAME}: ${PWD}\007\""
213 export PROMPT_COMMAND="echo -ne \"\033]0;[$apps $variant] ${USER}@${HOSTNAME}: ${PWD}\007\""
218 function addcompletions()
222 # Keep us from trying to run in something that isn't bash.
223 if [ -z "${BASH_VERSION}" ]; then
227 # Keep us from trying to run in bash that's too old.
228 if [ ${BASH_VERSINFO[0]} -lt 3 ]; then
232 dir="sdk/bash_completion"
233 if [ -d ${dir} ]; then
234 for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do
241 function choosetype()
243 echo "Build type choices are:"
248 local DEFAULT_NUM DEFAULT_VALUE
250 DEFAULT_VALUE=release
252 export TARGET_BUILD_TYPE=
254 while [ -z $TARGET_BUILD_TYPE ]
256 echo -n "Which would you like? ["$DEFAULT_NUM"] "
257 if [ -z "$1" ] ; then
265 export TARGET_BUILD_TYPE=$DEFAULT_VALUE
268 export TARGET_BUILD_TYPE=release
271 export TARGET_BUILD_TYPE=release
274 export TARGET_BUILD_TYPE=debug
277 export TARGET_BUILD_TYPE=debug
281 echo "I didn't understand your response. Please try again."
285 if [ -n "$1" ] ; then
290 set_stuff_for_environment
294 # This function isn't really right: It chooses a TARGET_PRODUCT
295 # based on the list of boards. Usually, that gets you something
296 # that kinda works with a generic product, but really, you should
297 # pick a product by name.
299 function chooseproduct()
301 if [ "x$TARGET_PRODUCT" != x ] ; then
302 default_value=$TARGET_PRODUCT
307 export TARGET_PRODUCT=
309 while [ -z "$TARGET_PRODUCT" ]
311 echo -n "Which product would you like? [$default_value] "
312 if [ -z "$1" ] ; then
319 if [ -z "$ANSWER" ] ; then
320 export TARGET_PRODUCT=$default_value
322 if check_product $ANSWER
324 export TARGET_PRODUCT=$ANSWER
326 echo "** Not a valid product: $ANSWER"
329 if [ -n "$1" ] ; then
334 set_stuff_for_environment
337 function choosevariant()
339 echo "Variant choices are:"
342 for v in ${VARIANT_CHOICES[@]}
344 # The product name is the name of the directory containing
345 # the makefile we found, above.
350 local default_value=eng
353 export TARGET_BUILD_VARIANT=
354 while [ -z "$TARGET_BUILD_VARIANT" ]
356 echo -n "Which would you like? [$default_value] "
357 if [ -z "$1" ] ; then
364 if [ -z "$ANSWER" ] ; then
365 export TARGET_BUILD_VARIANT=$default_value
366 elif (echo -n $ANSWER | grep -q -e "^[0-9][0-9]*$") ; then
367 if [ "$ANSWER" -le "${#VARIANT_CHOICES[@]}" ] ; then
368 export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-1))]}
371 if check_variant $ANSWER
373 export TARGET_BUILD_VARIANT=$ANSWER
375 echo "** Not a valid variant: $ANSWER"
378 if [ -n "$1" ] ; then
384 function choosecombo()
397 set_stuff_for_environment
401 # Clear this variable. It will be built up again when the vendorsetup.sh
402 # files are included at the end of this file.
403 unset LUNCH_MENU_CHOICES
404 function add_lunch_combo()
408 for c in ${LUNCH_MENU_CHOICES[@]} ; do
409 if [ "$new_combo" = "$c" ] ; then
413 LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo)
416 # add the default one here
417 add_lunch_combo full-eng
418 add_lunch_combo full_x86-eng
419 add_lunch_combo vbox_x86-eng
421 function print_lunch_menu()
425 echo "You're building on" $uname
427 echo "Lunch menu... pick a combo:"
431 for choice in ${LUNCH_MENU_CHOICES[@]}
448 echo -n "Which would you like? [full-eng] "
457 elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")
459 if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]
461 selection=${LUNCH_MENU_CHOICES[$(($answer-1))]}
463 elif (echo -n $answer | grep -q -e "^[^\-][^\-]*-[^\-][^\-]*$")
468 if [ -z "$selection" ]
471 echo "Invalid lunch combo: $answer"
475 export TARGET_BUILD_APPS=
477 local product=$(echo -n $selection | sed -e "s/-.*$//")
478 check_product $product
482 echo "** Don't have a product spec for: '$product'"
483 echo "** Do you have the right repo manifest?"
487 local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")
488 check_variant $variant
492 echo "** Invalid variant: '$variant'"
493 echo "** Must be one of ${VARIANT_CHOICES[@]}"
497 if [ -z "$product" -o -z "$variant" ]
503 export TARGET_PRODUCT=$product
504 export TARGET_BUILD_VARIANT=$variant
505 export TARGET_BUILD_TYPE=release
509 set_stuff_for_environment
513 # Tab completion for lunch.
518 cur="${COMP_WORDS[COMP_CWORD]}"
519 prev="${COMP_WORDS[COMP_CWORD-1]}"
521 COMPREPLY=( $(compgen -W "${LUNCH_MENU_CHOICES[*]}" -- ${cur}) )
524 complete -F _lunch lunch
526 # Configures the build to build unbundled apps.
527 # Run tapas with one ore more app names (from LOCAL_PACKAGE_NAME)
530 local variant=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$'))
531 local apps=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng)$'))
533 if [ $(echo $variant | wc -w) -gt 1 ]; then
534 echo "tapas: Error: Multiple build variants supplied: $variant"
537 if [ -z "$variant" ]; then
540 if [ -z "$apps" ]; then
544 export TARGET_PRODUCT=full
545 export TARGET_BUILD_VARIANT=$variant
546 export TARGET_BUILD_TYPE=release
547 export TARGET_BUILD_APPS=$apps
549 set_stuff_for_environment
555 local TOPFILE=build/core/envsetup.mk
556 if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then
559 if [ -f $TOPFILE ] ; then
560 # The following circumlocution (repeated below as well) ensures
561 # that we record the true directory name and not one that is
562 # faked up with symlink names.
565 # We redirect cd to /dev/null in case it's aliased to
566 # a command that prints something as a side-effect
570 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
575 if [ -f "$T/$TOPFILE" ]; then
588 echo "Couldn't locate the top of the tree. Try setting TOP."
592 function findmakefile()
594 TOPFILE=build/core/envsetup.mk
595 # We redirect cd to /dev/null in case it's aliased to
596 # a command that prints something as a side-effect
600 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
602 if [ -f "$T/Android.mk" ]; then
614 # If we're sitting in the root of the build tree, just do a
616 if [ -f build/core/envsetup.mk -a -f Makefile ]; then
619 # Find the closest Android.mk file.
621 local M=$(findmakefile)
622 # Remove the path to top as the makefilepath needs to be relative
623 local M=`echo $M|sed 's:'$T'/::'`
625 echo "Couldn't locate the top of the tree. Try setting TOP."
626 elif [ ! "$M" ]; then
627 echo "Couldn't locate a makefile from the current directory."
629 ONE_SHOT_MAKEFILE=$M make -C $T all_modules $@
642 local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
643 local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
644 for DIR in $DIRS ; do
645 MODULES=`echo $DIR | sed -n -e 's/.*:\(.*$\)/\1/p' | sed 's/,/ /'`
646 if [ "$MODULES" = "" ]; then
649 DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'`
650 if [ -f $DIR/Android.mk ]; then
651 TO_CHOP=`(cd -P -- $T && pwd -P) | wc -c | tr -d ' '`
652 TO_CHOP=`expr $TO_CHOP + 1`
653 START=`PWD= /bin/pwd`
654 MFILE=`echo $START | cut -c${TO_CHOP}-`
655 if [ "$MFILE" = "" ] ; then
656 MFILE=$DIR/Android.mk
658 MFILE=$MFILE/$DIR/Android.mk
660 MAKEFILE="$MAKEFILE $MFILE"
662 if [ "$DIR" = snod ]; then
664 elif [ "$DIR" = showcommands ]; then
665 ARGS="$ARGS showcommands"
666 elif [ "$DIR" = dist ]; then
668 elif [ "$DIR" = incrementaljavac ]; then
669 ARGS="$ARGS incrementaljavac"
671 echo "No Android.mk in $DIR."
676 ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T $DASH_ARGS $MODULES $ARGS
678 echo "Couldn't locate the top of the tree. Try setting TOP."
688 echo "Couldn't locate the top of the tree. Try setting TOP."
694 TOPFILE=build/core/envsetup.mk
695 # We redirect cd to /dev/null in case it's aliased to
696 # a command that prints something as a side-effect
700 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
702 if [ -f "$T/Android.mk" ]; then
709 echo "can't find Android.mk"
716 local PID=`adb shell ps | fgrep $1 | sed -e 's/[^ ]* *\([0-9]*\).*/\1/'`
719 echo "usage: pid name"
723 # systemstack - dump the current stack trace of all threads in the system process
724 # to the usual ANR traces file
725 function systemstack()
727 adb shell echo '""' '>>' /data/anr/traces.txt && adb shell chmod 776 /data/anr/traces.txt && adb shell kill -3 $(pid system_server)
732 local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT)
733 local OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED)
734 local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)
735 local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED)
736 local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS)
737 local ARCH=$(get_build_var TARGET_ARCH)
740 x86) GDB=i686-android-linux-gdb;;
741 arm) GDB=arm-linux-androideabi-gdb;;
742 *) echo "Unknown arch $ARCH"; return 1;;
745 if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then
754 if [ "$PORT" ] ; then
762 if [ "$PROG" ] ; then
763 if [[ "$PROG" =~ ^[0-9]+$ ]] ; then
768 adb forward "tcp$PORT" "tcp$PORT"
769 adb shell gdbserver $PORT --attach $PID &
773 echo "If you haven't done so already, do this first on the device:"
774 echo " gdbserver $PORT /system/bin/$EXE"
776 echo " gdbserver $PORT --attach $PID"
780 echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS"
781 echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS:$OUT_SO_SYMBOLS/hw:$OUT_SO_SYMBOLS/ssl/engines"
782 echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
783 echo >>"$OUT_ROOT/gdbclient.cmds" ""
785 $ANDROID_TOOLCHAIN/$GDB -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
787 echo "Unable to determine build system output dir."
796 find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml|sh|mk)' -print0 | xargs -0 grep --color -n "$@"
803 find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cpp\|S\|java\|xml\|sh\|mk\)' -print0 | xargs -0 grep --color -n "$@"
810 find . -name .repo -prune -o -name .git -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
815 find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
820 for dir in `find . -name .repo -prune -o -name .git -prune -o -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
827 find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@"
832 find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@"
839 find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@"
844 find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@"
852 get_abs_build_var ANDROID_PREBUILTS
855 function tracedmdump()
859 echo "Couldn't locate the top of the tree. Try setting TOP."
862 local prebuiltdir=$(getprebuilt)
863 local KERNEL=$T/prebuilt/android-arm/kernel/vmlinux-qemu
866 if [ ! "$TRACE" ] ; then
867 echo "usage: tracedmdump tracename"
871 if [ ! -r "$KERNEL" ] ; then
872 echo "Error: cannot find kernel: '$KERNEL'"
876 local BASETRACE=$(basename $TRACE)
877 if [ "$BASETRACE" = "$TRACE" ] ; then
878 TRACE=$ANDROID_PRODUCT_OUT/traces/$TRACE
881 echo "post-processing traces..."
882 rm -f $TRACE/qtrace.dexlist
884 if [ $? -ne 0 ]; then
886 echo "*** Error: malformed trace. Did you remember to exit the emulator?"
890 echo "generating dexlist output..."
891 /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
892 echo "generating dmtrace data..."
893 q2dm -r $ANDROID_PRODUCT_OUT/symbols $TRACE $KERNEL $TRACE/dmtrace || return
894 echo "generating html file..."
895 dmtracedump -h $TRACE/dmtrace >| $TRACE/dmtrace.html || return
896 echo "done, see $TRACE/dmtrace.html for details"
898 echo " traceview $TRACE/dmtrace"
901 # communicate with a running device or emulator, set up necessary state,
902 # and run the hat command.
905 # process standard adb options
907 if [ "$1" = "-d" -o "$1" = "-e" ]; then
910 elif [ "$1" = "-s" ]; then
914 local adbOptions=${adbTarget}
915 echo adbOptions = ${adbOptions}
920 if [ "$targetPid" = "" ]; then
921 echo "Usage: runhat [ -d | -e | -s serial ] target-pid"
925 # confirm hat is available
926 if [ -z $(which hat) ]; then
927 echo "hat is not available in this configuration."
931 # issue "am" command to cause the hprof dump
932 local devFile=/sdcard/hprof-$targetPid
933 echo "Poking $targetPid and waiting for data..."
934 adb ${adbOptions} shell am dumpheap $targetPid $devFile
935 echo "Press enter when logcat shows \"hprof: heap dump completed\""
939 local localFile=/tmp/$$-hprof
941 echo "Retrieving file $devFile..."
942 adb ${adbOptions} pull $devFile $localFile
944 adb ${adbOptions} shell rm $devFile
946 echo "Running hat on $localFile"
947 echo "View the output by pointing your browser at http://localhost:7000/"
949 hat -JXmx512m $localFile
952 function getbugreports()
954 local reports=(`adb shell ls /sdcard/bugreports | tr -d '\r'`)
956 if [ ! "$reports" ]; then
957 echo "Could not locate any bugreports."
962 for report in ${reports[@]}
964 echo "/sdcard/bugreports/${report}"
965 adb pull /sdcard/bugreports/${report} ${report}
970 function startviewserver()
973 if [ $# -gt 0 ]; then
976 adb shell service call window 1 i32 $port
979 function stopviewserver()
981 adb shell service call window 2
984 function isviewserverstarted()
986 adb shell service call window 3
991 adb shell input keyevent 3
996 adb shell input keyevent 4
1001 adb shell input keyevent 82
1004 function smoketest()
1006 if [ ! "$ANDROID_PRODUCT_OUT" ]; then
1007 echo "Couldn't locate output files. Try running 'lunch' first." >&2
1012 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
1016 (cd "$T" && mmm tests/SmokeTest) &&
1017 adb uninstall com.android.smoketest > /dev/null &&
1018 adb uninstall com.android.smoketest.tests > /dev/null &&
1019 adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk &&
1020 adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTest.apk &&
1021 adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner
1024 # simple shortcut to the runtest command
1029 echo "Couldn't locate the top of the tree. Try setting TOP." >&2
1032 ("$T"/development/testrunner/runtest.py $@)
1036 if [[ -z "$1" ]]; then
1037 echo "Usage: godir <regex>"
1041 if [[ ! -f $T/filelist ]]; then
1042 echo -n "Creating index..."
1043 (cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist)
1048 lines=($(\grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq))
1049 if [[ ${#lines[@]} = 0 ]]; then
1055 if [[ ${#lines[@]} > 1 ]]; then
1056 while [[ -z "$pathname" ]]; do
1059 for line in ${lines[@]}; do
1060 printf "%6s %s\n" "[$index]" $line
1061 index=$(($index + 1))
1064 echo -n "Select one: "
1067 if [[ $choice -gt ${#lines[@]} || $choice -lt 1 ]]; then
1068 echo "Invalid choice"
1071 pathname=${lines[$(($choice-1))]}
1074 pathname=${lines[0]}
1079 # Force JAVA_HOME to point to java 1.6 if it isn't already set
1080 function set_java_home() {
1081 if [ ! "$JAVA_HOME" ]; then
1084 export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
1087 export JAVA_HOME=/usr/lib/jvm/java-6-sun
1093 if [ "x$SHELL" != "x/bin/bash" ]; then
1094 case `ps -o command -p $$` in
1098 echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
1103 # Execute the contents of any vendorsetup.sh files we can find.
1104 for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null`