echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
- (cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
+ (\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1)
}
fi
if [ -n "$ANDROID_PRE_BUILD_PATHS" ] ; then
export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/}
- # strip trailing ':', if any
- export PATH=${PATH/%:/}
+ # strip leading ':', if any
+ export PATH=${PATH/:%/}
fi
# and in with the new
# defined in core/config.mk
targetgccversion=$(get_build_var TARGET_GCC_VERSION)
+ export TARGET_GCC_VERSION=$targetgccversion
# The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
export ANDROID_EABI_TOOLCHAIN=
local ARCH=$(get_build_var TARGET_ARCH)
case $ARCH in
- x86) toolchaindir=x86/i686-linux-android-4.6/bin
+ x86) toolchaindir=x86/i686-linux-android-$targetgccversion/bin
;;
arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin
;;
- mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
+ mips) toolchaindir=mips/mipsel-linux-android-$targetgccversion/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
export ANDROID_QTOOLS=$T/development/emulator/qtools
export ANDROID_DEV_SCRIPTS=$T/development/scripts
- export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN$ARM_EABI_TOOLCHAIN_PATH$CODE_REVIEWS:$ANDROID_DEV_SCRIPTS
- export PATH=$PATH$ANDROID_BUILD_PATHS
+ export ANDROID_BUILD_PATHS=$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN$ARM_EABI_TOOLCHAIN_PATH$CODE_REVIEWS:$ANDROID_DEV_SCRIPTS:
+ export PATH=$ANDROID_BUILD_PATHS$PATH
unset ANDROID_JAVA_TOOLCHAIN
unset ANDROID_PRE_BUILD_PATHS
# faked up with symlink names.
PWD= /bin/pwd
else
- # We redirect cd to /dev/null in case it's aliased to
- # a command that prints something as a side-effect
- # (like pushd)
local HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
- cd .. > /dev/null
+ \cd ..
T=`PWD= /bin/pwd`
done
- cd $HERE > /dev/null
+ \cd $HERE
if [ -f "$T/$TOPFILE" ]; then
echo $T
fi
function findmakefile()
{
TOPFILE=build/core/envsetup.mk
- # We redirect cd to /dev/null in case it's aliased to
- # a command that prints something as a side-effect
- # (like pushd)
local HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
T=`PWD= /bin/pwd`
if [ -f "$T/Android.mk" ]; then
echo $T/Android.mk
- cd $HERE > /dev/null
+ \cd $HERE
return
fi
- cd .. > /dev/null
+ \cd ..
done
- cd $HERE > /dev/null
+ \cd $HERE
}
function mm()
fi
DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'`
if [ -f $DIR/Android.mk ]; then
- TO_CHOP=`(cd -P -- $T && pwd -P) | wc -c | tr -d ' '`
+ TO_CHOP=`(\cd -P -- $T && pwd -P) | wc -c | tr -d ' '`
TO_CHOP=`expr $TO_CHOP + 1`
START=`PWD= /bin/pwd`
MFILE=`echo $START | cut -c${TO_CHOP}-`
{
T=$(gettop)
if [ "$T" ]; then
- cd $(gettop)
+ \cd $(gettop)
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
function cproj()
{
TOPFILE=build/core/envsetup.mk
- # We redirect cd to /dev/null in case it's aliased to
- # a command that prints something as a side-effect
- # (like pushd)
local HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
T=$PWD
if [ -f "$T/Android.mk" ]; then
- cd $T
+ \cd $T
return
fi
- cd .. > /dev/null
+ \cd ..
done
- cd $HERE > /dev/null
+ \cd $HERE
echo "can't find Android.mk"
}
# to the usual ANR traces file
function systemstack()
{
- adb shell echo '""' '>>' /data/anr/traces.txt && adb shell chmod 776 /data/anr/traces.txt && adb shell kill -3 $(pid system_server)
+ stacks system_server
+}
+
+function stacks()
+{
+ if [[ $1 =~ ^[0-9]+$ ]] ; then
+ local PID="$1"
+ elif [ "$1" ] ; then
+ local PID=$(pid $1)
+ else
+ echo "usage: stacks [pid|process name]"
+ fi
+
+ if [ "$PID" ] ; then
+ local TRACES=/data/anr/traces.txt
+ local ORIG=/data/anr/traces.orig
+ local TMP=/data/anr/traces.tmp
+
+ # Keep original traces to avoid clobbering
+ adb shell mv $TRACES $ORIG
+
+ # Make sure we have a usable file
+ adb shell touch $TRACES
+ adb shell chmod 666 $TRACES
+
+ # Dump stacks and wait for dump to finish
+ adb shell kill -3 $PID
+ adb shell notify $TRACES
+
+ # Restore original stacks, and show current output
+ adb shell mv $TRACES $TMP
+ adb shell mv $ORIG $TRACES
+ adb shell cat $TMP | less -S
+ fi
}
function gdbclient()
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;
}
+function mangrep()
+{
+ find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -name 'AndroidManifest.xml' -print0 | xargs -0 grep --color -n "$@"
+}
+
case `uname -s` in
Darwin)
function mgrep()
return
fi
- (cd "$T" && mmm tests/SmokeTest) &&
+ (\cd "$T" && mmm tests/SmokeTest) &&
adb uninstall com.android.smoketest > /dev/null &&
adb uninstall com.android.smoketest.tests > /dev/null &&
adb install $ANDROID_PRODUCT_OUT/data/app/SmokeTestApp.apk &&
T=$(gettop)
if [[ ! -f $T/filelist ]]; then
echo -n "Creating index..."
- (cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist)
+ (\cd $T; find . -wholename ./out -prune -o -wholename ./.repo -prune -o -type f > filelist)
echo " Done"
echo ""
fi
else
pathname=${lines[0]}
fi
- cd $T/$pathname
+ \cd $T/$pathname
}
# Force JAVA_HOME to point to java 1.6 if it isn't already set