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