The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | function help() { |
| 2 | cat <<EOF |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 3 | Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment: |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 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. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 11 | - godir: Go to the directory containing a file. |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 12 | |
| 13 | Look at the source to view more functions. The complete list is: |
| 14 | EOF |
| 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. |
| 25 | function 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 |
Brian Carlstrom | 177285a | 2010-04-06 13:22:02 -0700 | [diff] [blame] | 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) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | # Get the exact value of a build variable. |
| 37 | function 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 Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 44 | 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 |
| 49 | function 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 \ |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 57 | TARGET_PRODUCT=$1 \ |
| 58 | TARGET_BUILD_VARIANT= \ |
| 59 | TARGET_BUILD_TYPE= \ |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 60 | TARGET_BUILD_APPS= \ |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 61 | get_build_var TARGET_DEVICE > /dev/null |
| 62 | # hide successful answers, but allow the errors to show |
| 63 | } |
| 64 | |
| 65 | VARIANT_CHOICES=(user userdebug eng) |
| 66 | |
| 67 | # check to see if the supplied variant is valid |
| 68 | function check_variant() |
| 69 | { |
| 70 | for v in ${VARIANT_CHOICES[@]} |
| 71 | do |
| 72 | if [ "$v" = "$1" ] |
| 73 | then |
| 74 | return 0 |
| 75 | fi |
| 76 | done |
| 77 | return 1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | function setpaths() |
| 81 | { |
| 82 | T=$(gettop) |
| 83 | if [ ! "$T" ]; then |
| 84 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 85 | return |
| 86 | fi |
| 87 | |
| 88 | ################################################################## |
| 89 | # # |
| 90 | # Read me before you modify this code # |
| 91 | # # |
| 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. # |
| 96 | # # |
| 97 | ################################################################## |
| 98 | |
Raphael Moll | c639c78 | 2011-06-20 17:25:01 -0700 | [diff] [blame] | 99 | # Note: on windows/cygwin, ANDROID_BUILD_PATHS will contain spaces |
| 100 | # due to "C:\Program Files" being in the path. |
| 101 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 102 | # out with the old |
Raphael Moll | c639c78 | 2011-06-20 17:25:01 -0700 | [diff] [blame] | 103 | if [ -n "$ANDROID_BUILD_PATHS" ] ; then |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 104 | export PATH=${PATH/$ANDROID_BUILD_PATHS/} |
| 105 | fi |
Raphael Moll | c639c78 | 2011-06-20 17:25:01 -0700 | [diff] [blame] | 106 | if [ -n "$ANDROID_PRE_BUILD_PATHS" ] ; then |
Doug Zongker | 2903498 | 2011-04-22 08:16:56 -0700 | [diff] [blame] | 107 | export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/} |
| 108 | # strip trailing ':', if any |
| 109 | export PATH=${PATH/%:/} |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 110 | fi |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 111 | |
| 112 | # and in with the new |
| 113 | CODE_REVIEWS= |
| 114 | prebuiltdir=$(getprebuilt) |
Raphael | 732936d | 2011-06-22 14:35:32 -0700 | [diff] [blame] | 115 | |
Raphael Moll | c639c78 | 2011-06-20 17:25:01 -0700 | [diff] [blame] | 116 | # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it. |
Raphael | 732936d | 2011-06-22 14:35:32 -0700 | [diff] [blame] | 117 | export ANDROID_EABI_TOOLCHAIN= |
| 118 | toolchaindir=toolchain/arm-linux-androideabi-4.4.x/bin |
Raphael Moll | c639c78 | 2011-06-20 17:25:01 -0700 | [diff] [blame] | 119 | if [ -d "$prebuiltdir/$toolchaindir" ]; then |
| 120 | export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir |
Raphael Moll | c639c78 | 2011-06-20 17:25:01 -0700 | [diff] [blame] | 121 | fi |
Raphael | 732936d | 2011-06-22 14:35:32 -0700 | [diff] [blame] | 122 | |
| 123 | export ARM_EABI_TOOLCHAIN= |
| 124 | toolchaindir=toolchain/arm-eabi-4.4.3/bin |
| 125 | if [ -d "$prebuiltdir/$toolchaindir" ]; then |
| 126 | export ARM_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir |
| 127 | fi |
| 128 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 129 | export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN |
| 130 | export ANDROID_QTOOLS=$T/development/emulator/qtools |
Jing Yu | 9d396e3 | 2010-07-29 15:07:31 -0700 | [diff] [blame] | 131 | export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ARM_EABI_TOOLCHAIN$CODE_REVIEWS |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 132 | export PATH=$PATH$ANDROID_BUILD_PATHS |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 133 | |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 134 | unset ANDROID_JAVA_TOOLCHAIN |
Ji-Hwan Lee | 752ad06 | 2011-07-04 14:09:47 +0900 | [diff] [blame] | 135 | unset ANDROID_PRE_BUILD_PATHS |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 136 | if [ -n "$JAVA_HOME" ]; then |
| 137 | export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin |
Ji-Hwan Lee | 752ad06 | 2011-07-04 14:09:47 +0900 | [diff] [blame] | 138 | export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN: |
| 139 | export PATH=$ANDROID_PRE_BUILD_PATHS$PATH |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 140 | fi |
| 141 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 142 | unset ANDROID_PRODUCT_OUT |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 143 | export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT) |
| 144 | export OUT=$ANDROID_PRODUCT_OUT |
| 145 | |
Jeff Brown | 8fd5cce | 2011-03-24 17:03:06 -0700 | [diff] [blame] | 146 | unset ANDROID_HOST_OUT |
| 147 | export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT) |
| 148 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 149 | # needed for building linux on MacOS |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 150 | # TODO: fix the path |
| 151 | #export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include |
| 152 | } |
| 153 | |
| 154 | function printconfig() |
| 155 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 156 | T=$(gettop) |
| 157 | if [ ! "$T" ]; then |
| 158 | echo "Couldn't locate the top of the tree. Try setting TOP." >&2 |
| 159 | return |
| 160 | fi |
| 161 | get_build_var report_config |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | function set_stuff_for_environment() |
| 165 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 166 | settitle |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 167 | set_java_home |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 168 | setpaths |
| 169 | set_sequence_number |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 170 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 171 | export ANDROID_BUILD_TOP=$(gettop) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | function set_sequence_number() |
| 175 | { |
Joe Onorato | aee4daa | 2010-06-23 14:03:13 -0700 | [diff] [blame] | 176 | export BUILD_ENV_SEQUENCE_NUMBER=10 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | function settitle() |
| 180 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 181 | if [ "$STAY_OFF_MY_LAWN" = "" ]; then |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 182 | local product=$TARGET_PRODUCT |
| 183 | local variant=$TARGET_BUILD_VARIANT |
| 184 | local apps=$TARGET_BUILD_APPS |
| 185 | if [ -z "$apps" ]; then |
| 186 | export PROMPT_COMMAND="echo -ne \"\033]0;[${product}-${variant}] ${USER}@${HOSTNAME}: ${PWD}\007\"" |
| 187 | else |
| 188 | export PROMPT_COMMAND="echo -ne \"\033]0;[$apps $variant] ${USER}@${HOSTNAME}: ${PWD}\007\"" |
| 189 | fi |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 190 | fi |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 191 | } |
| 192 | |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 193 | function addcompletions() |
| 194 | { |
| 195 | local T dir f |
| 196 | |
| 197 | # Keep us from trying to run in something that isn't bash. |
| 198 | if [ -z "${BASH_VERSION}" ]; then |
| 199 | return |
| 200 | fi |
| 201 | |
| 202 | # Keep us from trying to run in bash that's too old. |
| 203 | if [ ${BASH_VERSINFO[0]} -lt 3 ]; then |
| 204 | return |
| 205 | fi |
| 206 | |
| 207 | dir="sdk/bash_completion" |
| 208 | if [ -d ${dir} ]; then |
Kenny Root | 7546d61 | 2011-07-18 13:11:34 -0700 | [diff] [blame] | 209 | for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 210 | echo "including $f" |
| 211 | . $f |
| 212 | done |
| 213 | fi |
| 214 | } |
| 215 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 216 | function choosetype() |
| 217 | { |
| 218 | echo "Build type choices are:" |
| 219 | echo " 1. release" |
| 220 | echo " 2. debug" |
| 221 | echo |
| 222 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 223 | local DEFAULT_NUM DEFAULT_VALUE |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 224 | DEFAULT_NUM=1 |
| 225 | DEFAULT_VALUE=release |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 226 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 227 | export TARGET_BUILD_TYPE= |
| 228 | local ANSWER |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 229 | while [ -z $TARGET_BUILD_TYPE ] |
| 230 | do |
| 231 | echo -n "Which would you like? ["$DEFAULT_NUM"] " |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 232 | if [ -z "$1" ] ; then |
| 233 | read ANSWER |
| 234 | else |
| 235 | echo $1 |
| 236 | ANSWER=$1 |
| 237 | fi |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 238 | case $ANSWER in |
| 239 | "") |
| 240 | export TARGET_BUILD_TYPE=$DEFAULT_VALUE |
| 241 | ;; |
| 242 | 1) |
| 243 | export TARGET_BUILD_TYPE=release |
| 244 | ;; |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 245 | release) |
| 246 | export TARGET_BUILD_TYPE=release |
| 247 | ;; |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 248 | 2) |
| 249 | export TARGET_BUILD_TYPE=debug |
| 250 | ;; |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 251 | debug) |
| 252 | export TARGET_BUILD_TYPE=debug |
| 253 | ;; |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 254 | *) |
| 255 | echo |
| 256 | echo "I didn't understand your response. Please try again." |
| 257 | echo |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 258 | ;; |
| 259 | esac |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 260 | if [ -n "$1" ] ; then |
| 261 | break |
| 262 | fi |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 263 | done |
| 264 | |
| 265 | set_stuff_for_environment |
| 266 | } |
| 267 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 268 | # |
| 269 | # This function isn't really right: It chooses a TARGET_PRODUCT |
| 270 | # based on the list of boards. Usually, that gets you something |
| 271 | # that kinda works with a generic product, but really, you should |
| 272 | # pick a product by name. |
| 273 | # |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 274 | function chooseproduct() |
| 275 | { |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 276 | if [ "x$TARGET_PRODUCT" != x ] ; then |
| 277 | default_value=$TARGET_PRODUCT |
| 278 | else |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 279 | default_value=full |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 280 | fi |
| 281 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 282 | export TARGET_PRODUCT= |
| 283 | local ANSWER |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 284 | while [ -z "$TARGET_PRODUCT" ] |
| 285 | do |
Joe Onorato | 8849aed | 2009-04-29 15:56:47 -0700 | [diff] [blame] | 286 | echo -n "Which product would you like? [$default_value] " |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 287 | if [ -z "$1" ] ; then |
| 288 | read ANSWER |
| 289 | else |
| 290 | echo $1 |
| 291 | ANSWER=$1 |
| 292 | fi |
| 293 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 294 | if [ -z "$ANSWER" ] ; then |
| 295 | export TARGET_PRODUCT=$default_value |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 296 | else |
| 297 | if check_product $ANSWER |
| 298 | then |
| 299 | export TARGET_PRODUCT=$ANSWER |
| 300 | else |
| 301 | echo "** Not a valid product: $ANSWER" |
| 302 | fi |
| 303 | fi |
| 304 | if [ -n "$1" ] ; then |
| 305 | break |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 306 | fi |
| 307 | done |
| 308 | |
| 309 | set_stuff_for_environment |
| 310 | } |
| 311 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 312 | function choosevariant() |
| 313 | { |
| 314 | echo "Variant choices are:" |
| 315 | local index=1 |
| 316 | local v |
| 317 | for v in ${VARIANT_CHOICES[@]} |
| 318 | do |
| 319 | # The product name is the name of the directory containing |
| 320 | # the makefile we found, above. |
| 321 | echo " $index. $v" |
| 322 | index=$(($index+1)) |
| 323 | done |
| 324 | |
| 325 | local default_value=eng |
| 326 | local ANSWER |
| 327 | |
| 328 | export TARGET_BUILD_VARIANT= |
| 329 | while [ -z "$TARGET_BUILD_VARIANT" ] |
| 330 | do |
| 331 | echo -n "Which would you like? [$default_value] " |
| 332 | if [ -z "$1" ] ; then |
| 333 | read ANSWER |
| 334 | else |
| 335 | echo $1 |
| 336 | ANSWER=$1 |
| 337 | fi |
| 338 | |
| 339 | if [ -z "$ANSWER" ] ; then |
| 340 | export TARGET_BUILD_VARIANT=$default_value |
| 341 | elif (echo -n $ANSWER | grep -q -e "^[0-9][0-9]*$") ; then |
| 342 | if [ "$ANSWER" -le "${#VARIANT_CHOICES[@]}" ] ; then |
Kan-Ru Chen | 0745376 | 2010-07-05 15:53:47 +0800 | [diff] [blame] | 343 | export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-1))]} |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 344 | fi |
| 345 | else |
| 346 | if check_variant $ANSWER |
| 347 | then |
| 348 | export TARGET_BUILD_VARIANT=$ANSWER |
| 349 | else |
| 350 | echo "** Not a valid variant: $ANSWER" |
| 351 | fi |
| 352 | fi |
| 353 | if [ -n "$1" ] ; then |
| 354 | break |
| 355 | fi |
| 356 | done |
| 357 | } |
| 358 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 359 | function choosecombo() |
| 360 | { |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 361 | choosetype $1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 362 | |
| 363 | echo |
| 364 | echo |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 365 | chooseproduct $2 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 366 | |
| 367 | echo |
| 368 | echo |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 369 | choosevariant $3 |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 370 | |
| 371 | echo |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 372 | set_stuff_for_environment |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 373 | printconfig |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 374 | } |
| 375 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 376 | # Clear this variable. It will be built up again when the vendorsetup.sh |
| 377 | # files are included at the end of this file. |
| 378 | unset LUNCH_MENU_CHOICES |
| 379 | function add_lunch_combo() |
| 380 | { |
| 381 | local new_combo=$1 |
| 382 | local c |
| 383 | for c in ${LUNCH_MENU_CHOICES[@]} ; do |
| 384 | if [ "$new_combo" = "$c" ] ; then |
| 385 | return |
| 386 | fi |
| 387 | done |
| 388 | LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo) |
| 389 | } |
| 390 | |
| 391 | # add the default one here |
Jean-Baptiste Queru | 45038e0 | 2010-07-01 09:22:53 -0700 | [diff] [blame] | 392 | add_lunch_combo full-eng |
Jean-Baptiste Queru | 6c2df3e | 2010-07-15 14:04:39 -0700 | [diff] [blame] | 393 | add_lunch_combo full_x86-eng |
Bruce Beare | ba366c4 | 2011-02-15 16:46:08 -0800 | [diff] [blame] | 394 | add_lunch_combo vbox_x86-eng |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 395 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 396 | function print_lunch_menu() |
| 397 | { |
| 398 | local uname=$(uname) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 399 | echo |
| 400 | echo "You're building on" $uname |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 401 | echo |
| 402 | echo "Lunch menu... pick a combo:" |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 403 | |
| 404 | local i=1 |
| 405 | local choice |
| 406 | for choice in ${LUNCH_MENU_CHOICES[@]} |
| 407 | do |
| 408 | echo " $i. $choice" |
| 409 | i=$(($i+1)) |
| 410 | done |
| 411 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 412 | echo |
| 413 | } |
| 414 | |
| 415 | function lunch() |
| 416 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 417 | local answer |
| 418 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 419 | if [ "$1" ] ; then |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 420 | answer=$1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 421 | else |
| 422 | print_lunch_menu |
Jean-Baptiste Queru | 0332f0a | 2010-10-22 09:52:09 -0700 | [diff] [blame] | 423 | echo -n "Which would you like? [full-eng] " |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 424 | read answer |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 425 | fi |
| 426 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 427 | local selection= |
| 428 | |
| 429 | if [ -z "$answer" ] |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 430 | then |
Jean-Baptiste Queru | 0332f0a | 2010-10-22 09:52:09 -0700 | [diff] [blame] | 431 | selection=full-eng |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 432 | elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$") |
| 433 | then |
| 434 | if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ] |
| 435 | then |
Kan-Ru Chen | 0745376 | 2010-07-05 15:53:47 +0800 | [diff] [blame] | 436 | selection=${LUNCH_MENU_CHOICES[$(($answer-1))]} |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 437 | fi |
| 438 | elif (echo -n $answer | grep -q -e "^[^\-][^\-]*-[^\-][^\-]*$") |
| 439 | then |
| 440 | selection=$answer |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 441 | fi |
| 442 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 443 | if [ -z "$selection" ] |
| 444 | then |
| 445 | echo |
| 446 | echo "Invalid lunch combo: $answer" |
| 447 | return 1 |
| 448 | fi |
| 449 | |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 450 | export TARGET_BUILD_APPS= |
| 451 | |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 452 | local product=$(echo -n $selection | sed -e "s/-.*$//") |
| 453 | check_product $product |
| 454 | if [ $? -ne 0 ] |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 455 | then |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 456 | echo |
| 457 | echo "** Don't have a product spec for: '$product'" |
| 458 | echo "** Do you have the right repo manifest?" |
| 459 | product= |
| 460 | fi |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 461 | |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 462 | local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//") |
| 463 | check_variant $variant |
| 464 | if [ $? -ne 0 ] |
| 465 | then |
| 466 | echo |
| 467 | echo "** Invalid variant: '$variant'" |
| 468 | echo "** Must be one of ${VARIANT_CHOICES[@]}" |
| 469 | variant= |
| 470 | fi |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 471 | |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 472 | if [ -z "$product" -o -z "$variant" ] |
| 473 | then |
| 474 | echo |
| 475 | return 1 |
| 476 | fi |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 477 | |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 478 | export TARGET_PRODUCT=$product |
| 479 | export TARGET_BUILD_VARIANT=$variant |
| 480 | export TARGET_BUILD_TYPE=release |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 481 | |
| 482 | echo |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 483 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 484 | set_stuff_for_environment |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 485 | printconfig |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Jeff Davidson | 513d7a4 | 2010-08-02 10:00:44 -0700 | [diff] [blame] | 488 | # Tab completion for lunch. |
| 489 | function _lunch() |
| 490 | { |
| 491 | local cur prev opts |
| 492 | COMPREPLY=() |
| 493 | cur="${COMP_WORDS[COMP_CWORD]}" |
| 494 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 495 | |
| 496 | COMPREPLY=( $(compgen -W "${LUNCH_MENU_CHOICES[*]}" -- ${cur}) ) |
| 497 | return 0 |
| 498 | } |
| 499 | complete -F _lunch lunch |
| 500 | |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 501 | # Configures the build to build unbundled apps. |
| 502 | # Run tapas with one ore more app names (from LOCAL_PACKAGE_NAME) |
| 503 | function tapas() |
| 504 | { |
| 505 | local variant=$(echo -n $(echo $* | xargs -n 1 echo | grep -E '^(user|userdebug|eng)$')) |
| 506 | local apps=$(echo -n $(echo $* | xargs -n 1 echo | grep -E -v '^(user|userdebug|eng)$')) |
| 507 | |
| 508 | if [ $(echo $variant | wc -w) -gt 1 ]; then |
| 509 | echo "tapas: Error: Multiple build variants supplied: $variant" |
| 510 | return |
| 511 | fi |
| 512 | if [ -z "$variant" ]; then |
| 513 | variant=eng |
| 514 | fi |
Ying Wang | c048c9b | 2010-06-24 15:08:33 -0700 | [diff] [blame] | 515 | if [ -z "$apps" ]; then |
| 516 | apps=all |
| 517 | fi |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 518 | |
Jean-Baptiste Queru | 0332f0a | 2010-10-22 09:52:09 -0700 | [diff] [blame] | 519 | export TARGET_PRODUCT=full |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 520 | export TARGET_BUILD_VARIANT=$variant |
Joe Onorato | da12daf | 2010-06-09 18:18:31 -0700 | [diff] [blame] | 521 | export TARGET_BUILD_TYPE=release |
| 522 | export TARGET_BUILD_APPS=$apps |
| 523 | |
| 524 | set_stuff_for_environment |
| 525 | printconfig |
| 526 | } |
| 527 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 528 | function gettop |
| 529 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 530 | local TOPFILE=build/core/envsetup.mk |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 531 | if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ] ; then |
| 532 | echo $TOP |
| 533 | else |
| 534 | if [ -f $TOPFILE ] ; then |
Dan Bornstein | d0b274d | 2009-11-24 15:48:50 -0800 | [diff] [blame] | 535 | # The following circumlocution (repeated below as well) ensures |
| 536 | # that we record the true directory name and not one that is |
| 537 | # faked up with symlink names. |
| 538 | PWD= /bin/pwd |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 539 | else |
| 540 | # We redirect cd to /dev/null in case it's aliased to |
| 541 | # a command that prints something as a side-effect |
| 542 | # (like pushd) |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 543 | local HERE=$PWD |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 544 | T= |
| 545 | while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do |
| 546 | cd .. > /dev/null |
Dan Bornstein | d0b274d | 2009-11-24 15:48:50 -0800 | [diff] [blame] | 547 | T=`PWD= /bin/pwd` |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 548 | done |
| 549 | cd $HERE > /dev/null |
| 550 | if [ -f "$T/$TOPFILE" ]; then |
| 551 | echo $T |
| 552 | fi |
| 553 | fi |
| 554 | fi |
| 555 | } |
| 556 | |
| 557 | function m() |
| 558 | { |
| 559 | T=$(gettop) |
| 560 | if [ "$T" ]; then |
| 561 | make -C $T $@ |
| 562 | else |
| 563 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 564 | fi |
| 565 | } |
| 566 | |
| 567 | function findmakefile() |
| 568 | { |
| 569 | TOPFILE=build/core/envsetup.mk |
| 570 | # We redirect cd to /dev/null in case it's aliased to |
| 571 | # a command that prints something as a side-effect |
| 572 | # (like pushd) |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 573 | local HERE=$PWD |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 574 | T= |
| 575 | while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do |
| 576 | T=$PWD |
| 577 | if [ -f "$T/Android.mk" ]; then |
| 578 | echo $T/Android.mk |
| 579 | cd $HERE > /dev/null |
| 580 | return |
| 581 | fi |
| 582 | cd .. > /dev/null |
| 583 | done |
| 584 | cd $HERE > /dev/null |
| 585 | } |
| 586 | |
| 587 | function mm() |
| 588 | { |
| 589 | # If we're sitting in the root of the build tree, just do a |
| 590 | # normal make. |
| 591 | if [ -f build/core/envsetup.mk -a -f Makefile ]; then |
| 592 | make $@ |
| 593 | else |
| 594 | # Find the closest Android.mk file. |
| 595 | T=$(gettop) |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 596 | local M=$(findmakefile) |
Robert Greenwalt | 3c794d7 | 2009-07-15 15:07:44 -0700 | [diff] [blame] | 597 | # Remove the path to top as the makefilepath needs to be relative |
| 598 | local M=`echo $M|sed 's:'$T'/::'` |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 599 | if [ ! "$T" ]; then |
| 600 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 601 | elif [ ! "$M" ]; then |
| 602 | echo "Couldn't locate a makefile from the current directory." |
| 603 | else |
Ying Wang | 0188414 | 2010-07-20 16:18:16 -0700 | [diff] [blame] | 604 | ONE_SHOT_MAKEFILE=$M make -C $T all_modules $@ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 605 | fi |
| 606 | fi |
| 607 | } |
| 608 | |
| 609 | function mmm() |
| 610 | { |
| 611 | T=$(gettop) |
| 612 | if [ "$T" ]; then |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 613 | local MAKEFILE= |
| 614 | local ARGS= |
| 615 | local DIR TO_CHOP |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 616 | local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/') |
| 617 | local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/') |
| 618 | for DIR in $DIRS ; do |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 619 | DIR=`echo $DIR | sed -e 's:/$::'` |
| 620 | if [ -f $DIR/Android.mk ]; then |
Brian Carlstrom | c634d2c | 2010-09-17 12:25:50 -0700 | [diff] [blame] | 621 | TO_CHOP=`(cd -P -- $T && pwd -P) | wc -c | tr -d ' '` |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 622 | TO_CHOP=`expr $TO_CHOP + 1` |
Gilles Debunne | 8a20f58 | 2010-02-17 15:56:45 -0800 | [diff] [blame] | 623 | START=`PWD= /bin/pwd` |
| 624 | MFILE=`echo $START | cut -c${TO_CHOP}-` |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 625 | if [ "$MFILE" = "" ] ; then |
| 626 | MFILE=$DIR/Android.mk |
| 627 | else |
| 628 | MFILE=$MFILE/$DIR/Android.mk |
| 629 | fi |
| 630 | MAKEFILE="$MAKEFILE $MFILE" |
| 631 | else |
| 632 | if [ "$DIR" = snod ]; then |
| 633 | ARGS="$ARGS snod" |
| 634 | elif [ "$DIR" = showcommands ]; then |
| 635 | ARGS="$ARGS showcommands" |
Ying Wang | 0188414 | 2010-07-20 16:18:16 -0700 | [diff] [blame] | 636 | elif [ "$DIR" = dist ]; then |
| 637 | ARGS="$ARGS dist" |
Ying Wang | 015edd2 | 2011-01-20 15:01:56 -0800 | [diff] [blame] | 638 | elif [ "$DIR" = incrementaljavac ]; then |
| 639 | ARGS="$ARGS incrementaljavac" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 640 | else |
| 641 | echo "No Android.mk in $DIR." |
Joe Onorato | 51e6182 | 2009-04-13 15:36:15 -0400 | [diff] [blame] | 642 | return 1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 643 | fi |
| 644 | fi |
| 645 | done |
Ying Wang | 0188414 | 2010-07-20 16:18:16 -0700 | [diff] [blame] | 646 | ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T $DASH_ARGS all_modules $ARGS |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 647 | else |
| 648 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 649 | fi |
| 650 | } |
| 651 | |
| 652 | function croot() |
| 653 | { |
| 654 | T=$(gettop) |
| 655 | if [ "$T" ]; then |
| 656 | cd $(gettop) |
| 657 | else |
| 658 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 659 | fi |
| 660 | } |
| 661 | |
Joe Onorato | 2a5d4d8 | 2009-07-30 10:23:21 -0700 | [diff] [blame] | 662 | function cproj() |
| 663 | { |
| 664 | TOPFILE=build/core/envsetup.mk |
| 665 | # We redirect cd to /dev/null in case it's aliased to |
| 666 | # a command that prints something as a side-effect |
| 667 | # (like pushd) |
| 668 | local HERE=$PWD |
| 669 | T= |
| 670 | while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do |
| 671 | T=$PWD |
| 672 | if [ -f "$T/Android.mk" ]; then |
| 673 | cd $T |
| 674 | return |
| 675 | fi |
| 676 | cd .. > /dev/null |
| 677 | done |
| 678 | cd $HERE > /dev/null |
| 679 | echo "can't find Android.mk" |
| 680 | } |
| 681 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 682 | function pid() |
| 683 | { |
| 684 | local EXE="$1" |
| 685 | if [ "$EXE" ] ; then |
| 686 | local PID=`adb shell ps | fgrep $1 | sed -e 's/[^ ]* *\([0-9]*\).*/\1/'` |
| 687 | echo "$PID" |
| 688 | else |
| 689 | echo "usage: pid name" |
| 690 | fi |
| 691 | } |
| 692 | |
Christopher Tate | 744ee80 | 2009-11-12 15:33:08 -0800 | [diff] [blame] | 693 | # systemstack - dump the current stack trace of all threads in the system process |
| 694 | # to the usual ANR traces file |
| 695 | function systemstack() |
| 696 | { |
| 697 | adb shell echo '""' '>>' /data/anr/traces.txt && adb shell chmod 776 /data/anr/traces.txt && adb shell kill -3 $(pid system_server) |
| 698 | } |
| 699 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 700 | function gdbclient() |
| 701 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 702 | local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT) |
| 703 | local OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED) |
| 704 | local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED) |
| 705 | local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED) |
| 706 | local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 707 | if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then |
| 708 | local EXE="$1" |
| 709 | if [ "$EXE" ] ; then |
| 710 | EXE=$1 |
| 711 | else |
| 712 | EXE="app_process" |
| 713 | fi |
| 714 | |
| 715 | local PORT="$2" |
| 716 | if [ "$PORT" ] ; then |
| 717 | PORT=$2 |
| 718 | else |
| 719 | PORT=":5039" |
| 720 | fi |
| 721 | |
| 722 | local PID |
| 723 | local PROG="$3" |
| 724 | if [ "$PROG" ] ; then |
Grace Kloba | e9d04bf | 2011-04-30 11:04:05 -0700 | [diff] [blame] | 725 | if [[ "$PROG" =~ ^[0-9]+$ ]] ; then |
| 726 | PID="$3" |
| 727 | else |
| 728 | PID=`pid $3` |
| 729 | fi |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 730 | adb forward "tcp$PORT" "tcp$PORT" |
| 731 | adb shell gdbserver $PORT --attach $PID & |
| 732 | sleep 2 |
| 733 | else |
| 734 | echo "" |
| 735 | echo "If you haven't done so already, do this first on the device:" |
| 736 | echo " gdbserver $PORT /system/bin/$EXE" |
| 737 | echo " or" |
| 738 | echo " gdbserver $PORT --attach $PID" |
| 739 | echo "" |
| 740 | fi |
| 741 | |
| 742 | echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS" |
| 743 | echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS" |
| 744 | echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT" |
| 745 | echo >>"$OUT_ROOT/gdbclient.cmds" "" |
| 746 | |
Jing Yu | 9d396e3 | 2010-07-29 15:07:31 -0700 | [diff] [blame] | 747 | arm-linux-androideabi-gdb -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 748 | else |
| 749 | echo "Unable to determine build system output dir." |
| 750 | fi |
| 751 | |
| 752 | } |
| 753 | |
| 754 | case `uname -s` in |
| 755 | Darwin) |
| 756 | function sgrep() |
| 757 | { |
Joe Onorato | f50e84b | 2011-03-15 14:15:46 -0700 | [diff] [blame] | 758 | 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 "$@" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 759 | } |
| 760 | |
| 761 | ;; |
| 762 | *) |
| 763 | function sgrep() |
| 764 | { |
Joe Onorato | f50e84b | 2011-03-15 14:15:46 -0700 | [diff] [blame] | 765 | 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 "$@" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 766 | } |
| 767 | ;; |
| 768 | esac |
| 769 | |
| 770 | function jgrep() |
| 771 | { |
Joe Onorato | f50e84b | 2011-03-15 14:15:46 -0700 | [diff] [blame] | 772 | find . -name .repo -prune -o -name .git -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 773 | } |
| 774 | |
| 775 | function cgrep() |
| 776 | { |
Mike Dodd | 0c26d34 | 2011-04-07 13:29:06 -0700 | [diff] [blame] | 777 | 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 "$@" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 778 | } |
| 779 | |
| 780 | function resgrep() |
| 781 | { |
Joe Onorato | f50e84b | 2011-03-15 14:15:46 -0700 | [diff] [blame] | 782 | 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; |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | case `uname -s` in |
| 786 | Darwin) |
| 787 | function mgrep() |
| 788 | { |
Joe Onorato | f50e84b | 2011-03-15 14:15:46 -0700 | [diff] [blame] | 789 | find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 790 | } |
| 791 | |
| 792 | function treegrep() |
| 793 | { |
Joe Onorato | f50e84b | 2011-03-15 14:15:46 -0700 | [diff] [blame] | 794 | 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 "$@" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 795 | } |
| 796 | |
| 797 | ;; |
| 798 | *) |
| 799 | function mgrep() |
| 800 | { |
Joe Onorato | f50e84b | 2011-03-15 14:15:46 -0700 | [diff] [blame] | 801 | 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 "$@" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 802 | } |
| 803 | |
| 804 | function treegrep() |
| 805 | { |
Joe Onorato | f50e84b | 2011-03-15 14:15:46 -0700 | [diff] [blame] | 806 | 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 "$@" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 807 | } |
| 808 | |
| 809 | ;; |
| 810 | esac |
| 811 | |
| 812 | function getprebuilt |
| 813 | { |
| 814 | get_abs_build_var ANDROID_PREBUILTS |
| 815 | } |
| 816 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 817 | function tracedmdump() |
| 818 | { |
| 819 | T=$(gettop) |
| 820 | if [ ! "$T" ]; then |
| 821 | echo "Couldn't locate the top of the tree. Try setting TOP." |
| 822 | return |
| 823 | fi |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 824 | local prebuiltdir=$(getprebuilt) |
Jack Veenstra | 60116fc | 2009-04-09 18:12:34 -0700 | [diff] [blame] | 825 | local KERNEL=$T/prebuilt/android-arm/kernel/vmlinux-qemu |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 826 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 827 | local TRACE=$1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 828 | if [ ! "$TRACE" ] ; then |
| 829 | echo "usage: tracedmdump tracename" |
| 830 | return |
| 831 | fi |
| 832 | |
Jack Veenstra | 60116fc | 2009-04-09 18:12:34 -0700 | [diff] [blame] | 833 | if [ ! -r "$KERNEL" ] ; then |
| 834 | echo "Error: cannot find kernel: '$KERNEL'" |
| 835 | return |
| 836 | fi |
| 837 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 838 | local BASETRACE=$(basename $TRACE) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 839 | if [ "$BASETRACE" = "$TRACE" ] ; then |
| 840 | TRACE=$ANDROID_PRODUCT_OUT/traces/$TRACE |
| 841 | fi |
| 842 | |
| 843 | echo "post-processing traces..." |
| 844 | rm -f $TRACE/qtrace.dexlist |
| 845 | post_trace $TRACE |
| 846 | if [ $? -ne 0 ]; then |
| 847 | echo "***" |
| 848 | echo "*** Error: malformed trace. Did you remember to exit the emulator?" |
| 849 | echo "***" |
| 850 | return |
| 851 | fi |
| 852 | echo "generating dexlist output..." |
| 853 | /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 |
| 854 | echo "generating dmtrace data..." |
| 855 | q2dm -r $ANDROID_PRODUCT_OUT/symbols $TRACE $KERNEL $TRACE/dmtrace || return |
| 856 | echo "generating html file..." |
| 857 | dmtracedump -h $TRACE/dmtrace >| $TRACE/dmtrace.html || return |
| 858 | echo "done, see $TRACE/dmtrace.html for details" |
| 859 | echo "or run:" |
| 860 | echo " traceview $TRACE/dmtrace" |
| 861 | } |
| 862 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 863 | # communicate with a running device or emulator, set up necessary state, |
| 864 | # and run the hat command. |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 865 | function runhat() |
| 866 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 867 | # process standard adb options |
| 868 | local adbTarget="" |
Andy McFadden | b628985 | 2010-07-12 08:00:19 -0700 | [diff] [blame] | 869 | if [ "$1" = "-d" -o "$1" = "-e" ]; then |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 870 | adbTarget=$1 |
| 871 | shift 1 |
Andy McFadden | b628985 | 2010-07-12 08:00:19 -0700 | [diff] [blame] | 872 | elif [ "$1" = "-s" ]; then |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 873 | adbTarget="$1 $2" |
| 874 | shift 2 |
| 875 | fi |
| 876 | local adbOptions=${adbTarget} |
| 877 | echo adbOptions = ${adbOptions} |
| 878 | |
| 879 | # runhat options |
| 880 | local targetPid=$1 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 881 | |
| 882 | if [ "$targetPid" = "" ]; then |
Andy McFadden | b628985 | 2010-07-12 08:00:19 -0700 | [diff] [blame] | 883 | echo "Usage: runhat [ -d | -e | -s serial ] target-pid" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 884 | return |
| 885 | fi |
| 886 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 887 | # confirm hat is available |
| 888 | if [ -z $(which hat) ]; then |
| 889 | echo "hat is not available in this configuration." |
| 890 | return |
| 891 | fi |
| 892 | |
Andy McFadden | b628985 | 2010-07-12 08:00:19 -0700 | [diff] [blame] | 893 | # issue "am" command to cause the hprof dump |
| 894 | local devFile=/sdcard/hprof-$targetPid |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 895 | echo "Poking $targetPid and waiting for data..." |
Andy McFadden | b628985 | 2010-07-12 08:00:19 -0700 | [diff] [blame] | 896 | adb ${adbOptions} shell am dumpheap $targetPid $devFile |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 897 | echo "Press enter when logcat shows \"hprof: heap dump completed\"" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 898 | echo -n "> " |
| 899 | read |
| 900 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 901 | local localFile=/tmp/$$-hprof |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 902 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 903 | echo "Retrieving file $devFile..." |
| 904 | adb ${adbOptions} pull $devFile $localFile |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 905 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 906 | adb ${adbOptions} shell rm $devFile |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 907 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 908 | echo "Running hat on $localFile" |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 909 | echo "View the output by pointing your browser at http://localhost:7000/" |
| 910 | echo "" |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 911 | hat $localFile |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 912 | } |
| 913 | |
| 914 | function getbugreports() |
| 915 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 916 | local reports=(`adb shell ls /sdcard/bugreports | tr -d '\r'`) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 917 | |
| 918 | if [ ! "$reports" ]; then |
| 919 | echo "Could not locate any bugreports." |
| 920 | return |
| 921 | fi |
| 922 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 923 | local report |
| 924 | for report in ${reports[@]} |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 925 | do |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 926 | echo "/sdcard/bugreports/${report}" |
| 927 | adb pull /sdcard/bugreports/${report} ${report} |
| 928 | gunzip ${report} |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 929 | done |
| 930 | } |
| 931 | |
| 932 | function startviewserver() |
| 933 | { |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 934 | local port=4939 |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 935 | if [ $# -gt 0 ]; then |
| 936 | port=$1 |
| 937 | fi |
| 938 | adb shell service call window 1 i32 $port |
| 939 | } |
| 940 | |
| 941 | function stopviewserver() |
| 942 | { |
| 943 | adb shell service call window 2 |
| 944 | } |
| 945 | |
| 946 | function isviewserverstarted() |
| 947 | { |
| 948 | adb shell service call window 3 |
| 949 | } |
| 950 | |
Romain Guy | b84049a | 2010-10-04 16:56:11 -0700 | [diff] [blame] | 951 | function key_home() |
| 952 | { |
| 953 | adb shell input keyevent 3 |
| 954 | } |
| 955 | |
| 956 | function key_back() |
| 957 | { |
| 958 | adb shell input keyevent 4 |
| 959 | } |
| 960 | |
| 961 | function key_menu() |
| 962 | { |
| 963 | adb shell input keyevent 82 |
| 964 | } |
| 965 | |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 966 | function smoketest() |
| 967 | { |
| 968 | if [ ! "$ANDROID_PRODUCT_OUT" ]; then |
| 969 | echo "Couldn't locate output files. Try running 'lunch' first." >&2 |
| 970 | return |
| 971 | fi |
| 972 | T=$(gettop) |
| 973 | if [ ! "$T" ]; then |
| 974 | echo "Couldn't locate the top of the tree. Try setting TOP." >&2 |
| 975 | return |
| 976 | fi |
| 977 | |
| 978 | (cd "$T" && mmm tests/SmokeTest) && |
| 979 | adb uninstall com.android.smoketest > /dev/null && |
| 980 | adb uninstall com.android.smoketest.tests > /dev/null && |
| 981 | adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk && |
| 982 | adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTest.apk && |
| 983 | adb shell am instrument -w com.android.smoketest.tests/android.test.InstrumentationTestRunner |
| 984 | } |
| 985 | |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 986 | # simple shortcut to the runtest command |
| 987 | function runtest() |
| 988 | { |
| 989 | T=$(gettop) |
| 990 | if [ ! "$T" ]; then |
| 991 | echo "Couldn't locate the top of the tree. Try setting TOP." >&2 |
| 992 | return |
| 993 | fi |
Brett Chabot | 3fb149d | 2009-10-21 20:05:26 -0700 | [diff] [blame] | 994 | ("$T"/development/testrunner/runtest.py $@) |
Brett Chabot | 762748c | 2009-03-27 10:25:11 -0700 | [diff] [blame] | 995 | } |
| 996 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 997 | function godir () { |
| 998 | if [[ -z "$1" ]]; then |
| 999 | echo "Usage: godir <regex>" |
| 1000 | return |
| 1001 | fi |
Brian Carlstrom | b9915a6 | 2010-01-29 16:39:32 -0800 | [diff] [blame] | 1002 | T=$(gettop) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1003 | if [[ ! -f $T/filelist ]]; then |
| 1004 | echo -n "Creating index..." |
Brian Carlstrom | 259e5b7 | 2010-01-30 11:45:03 -0800 | [diff] [blame] | 1005 | (cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1006 | echo " Done" |
| 1007 | echo "" |
| 1008 | fi |
| 1009 | local lines |
Doug Zongker | 2903498 | 2011-04-22 08:16:56 -0700 | [diff] [blame] | 1010 | lines=($(grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1011 | if [[ ${#lines[@]} = 0 ]]; then |
| 1012 | echo "Not found" |
| 1013 | return |
| 1014 | fi |
| 1015 | local pathname |
| 1016 | local choice |
| 1017 | if [[ ${#lines[@]} > 1 ]]; then |
| 1018 | while [[ -z "$pathname" ]]; do |
| 1019 | local index=1 |
| 1020 | local line |
| 1021 | for line in ${lines[@]}; do |
| 1022 | printf "%6s %s\n" "[$index]" $line |
Doug Zongker | 2903498 | 2011-04-22 08:16:56 -0700 | [diff] [blame] | 1023 | index=$(($index + 1)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1024 | done |
| 1025 | echo |
| 1026 | echo -n "Select one: " |
| 1027 | unset choice |
| 1028 | read choice |
| 1029 | if [[ $choice -gt ${#lines[@]} || $choice -lt 1 ]]; then |
| 1030 | echo "Invalid choice" |
| 1031 | continue |
| 1032 | fi |
Kan-Ru Chen | 0745376 | 2010-07-05 15:53:47 +0800 | [diff] [blame] | 1033 | pathname=${lines[$(($choice-1))]} |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1034 | done |
| 1035 | else |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1036 | pathname=${lines[0]} |
| 1037 | fi |
| 1038 | cd $T/$pathname |
| 1039 | } |
| 1040 | |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 1041 | # Force JAVA_HOME to point to java 1.6 if it isn't already set |
| 1042 | function set_java_home() { |
Andy McFadden | bd96094 | 2010-06-24 12:52:51 -0700 | [diff] [blame] | 1043 | if [ ! "$JAVA_HOME" ]; then |
| 1044 | case `uname -s` in |
| 1045 | Darwin) |
| 1046 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home |
| 1047 | ;; |
| 1048 | *) |
| 1049 | export JAVA_HOME=/usr/lib/jvm/java-6-sun |
| 1050 | ;; |
| 1051 | esac |
Jeff Hamilton | 04be0d8 | 2010-06-07 15:03:54 -0500 | [diff] [blame] | 1052 | fi |
Jeff Hamilton | 4a1c70e | 2010-06-21 18:26:38 -0500 | [diff] [blame] | 1053 | } |
Jeff Hamilton | 04be0d8 | 2010-06-07 15:03:54 -0500 | [diff] [blame] | 1054 | |
Raphael Moll | 70a86b0 | 2011-06-20 16:03:14 -0700 | [diff] [blame] | 1055 | if [ "x$SHELL" != "x/bin/bash" ]; then |
| 1056 | case `ps -o command -p $$` in |
| 1057 | *bash*) |
| 1058 | ;; |
| 1059 | *) |
| 1060 | echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results" |
| 1061 | ;; |
| 1062 | esac |
| 1063 | fi |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 1064 | |
| 1065 | # Execute the contents of any vendorsetup.sh files we can find. |
Bruce Beare | 6f8410b | 2010-06-24 13:51:35 -0700 | [diff] [blame] | 1066 | for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null` |
The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -0800 | [diff] [blame] | 1067 | do |
| 1068 | echo "including $f" |
| 1069 | . $f |
| 1070 | done |
| 1071 | unset f |
Kenny Root | 52aa81c | 2011-07-15 11:07:06 -0700 | [diff] [blame] | 1072 | |
| 1073 | addcompletions |