# #
##################################################################
+ # Note: on windows/cygwin, ANDROID_BUILD_PATHS will contain spaces
+ # due to "C:\Program Files" being in the path.
+
# out with the old
- if [ -n $ANDROID_BUILD_PATHS ] ; then
+ if [ -n "$ANDROID_BUILD_PATHS" ] ; then
export PATH=${PATH/$ANDROID_BUILD_PATHS/}
fi
- if [ -n $ANDROID_PRE_BUILD_PATHS ] ; then
+ if [ -n "$ANDROID_PRE_BUILD_PATHS" ] ; then
export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/}
fi
# and in with the new
CODE_REVIEWS=
prebuiltdir=$(getprebuilt)
- export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-eabi-4.4.3/bin
+ toolchaindir=toolchain/arm-eabi-4.4.3/bin
+ # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
+ if [ -d "$prebuiltdir/$toolchaindir" ]; then
+ export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir
+ else
+ export ANDROID_EABI_TOOLCHAIN=
+ fi
export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
export ANDROID_QTOOLS=$T/development/emulator/qtools
export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_EABI_TOOLCHAIN$CODE_REVIEWS
export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
export OUT=$ANDROID_PRODUCT_OUT
+ unset ANDROID_HOST_OUT
+ export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT)
+
# needed for building linux on MacOS
# TODO: fix the path
#export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include
setpaths
set_sequence_number
- # Don't try to do preoptimization until it works better on OSX.
- export DISABLE_DEXPREOPT=true
-
export ANDROID_BUILD_TOP=$(gettop)
}
fi
}
+function addcompletions()
+{
+ local T dir f
+
+ # Keep us from trying to run in something that isn't bash.
+ if [ -z "${BASH_VERSION}" ]; then
+ return
+ fi
+
+ # Keep us from trying to run in bash that's too old.
+ if [ ${BASH_VERSINFO[0]} -lt 3 ]; then
+ return
+ fi
+
+ dir="sdk/bash_completion"
+ if [ -d ${dir} ]; then
+ for f in `/bin/ls ${dir}/[a-z]*.bash 2> /dev/null`; do
+ echo "including $f"
+ . $f
+ done
+ fi
+}
+
case `uname -s` in
Linux)
function choosesim()
export TARGET_BUILD_VARIANT=$default_value
elif (echo -n $ANSWER | grep -q -e "^[0-9][0-9]*$") ; then
if [ "$ANSWER" -le "${#VARIANT_CHOICES[@]}" ] ; then
- export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-$_arrayoffset))]}
+ export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-1))]}
fi
else
if check_variant $ANSWER
# add the default one here
add_lunch_combo generic-eng
-
-# if we're on linux, add the simulator. There is a special case
-# in lunch to deal with the simulator
-if [ "$(uname)" = "Linux" ] ; then
- add_lunch_combo simulator
-fi
+add_lunch_combo generic_x86-eng
function print_lunch_menu()
{
then
if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]
then
- selection=${LUNCH_MENU_CHOICES[$(($answer-$_arrayoffset))]}
+ selection=${LUNCH_MENU_CHOICES[$(($answer-1))]}
fi
elif (echo -n $answer | grep -q -e "^[^\-][^\-]*-[^\-][^\-]*$")
then
for DIR in $DIRS ; do
DIR=`echo $DIR | sed -e 's:/$::'`
if [ -f $DIR/Android.mk ]; then
- TO_CHOP=`echo $T | 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}-`
{
# process standard adb options
local adbTarget=""
- if [ $1 = "-d" -o $1 = "-e" ]; then
+ if [ "$1" = "-d" -o "$1" = "-e" ]; then
adbTarget=$1
shift 1
- elif [ $1 = "-s" ]; then
+ elif [ "$1" = "-s" ]; then
adbTarget="$1 $2"
shift 2
fi
echo "Invalid choice"
continue
fi
- pathname=${lines[$(($choice-$_arrayoffset))]}
+ pathname=${lines[$(($choice-1))]}
done
else
- # even though zsh arrays are 1-based, $foo[0] is an alias for $foo[1]
pathname=${lines[0]}
fi
cd $T/$pathname
fi
}
-# determine whether arrays are zero-based (bash) or one-based (zsh)
-_xarray=(a b c)
-if [ -z "${_xarray[${#_xarray[@]}]}" ]
-then
- _arrayoffset=1
-else
- _arrayoffset=0
+if [ "x$SHELL" != "x/bin/bash" ]; then
+ case `ps -o command -p $$` in
+ *bash*)
+ ;;
+ *)
+ echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
+ ;;
+ esac
fi
-unset _xarray
# Execute the contents of any vendorsetup.sh files we can find.
-for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/build/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null`
+for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null`
do
echo "including $f"
. $f
done
unset f
+
+addcompletions