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