diff options
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 82 |
1 files changed, 69 insertions, 13 deletions
diff --git a/envsetup.sh b/envsetup.sh index 5c66a9e..ca282b6 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -2,7 +2,7 @@ function hmm() { cat <<EOF Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment: - lunch: lunch <product_name>-<build_variant> -- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|armv5] [eng|userdebug|user] +- tapas: tapas [<App1> <App2> ...] [arm|x86|mips|armv5|arm64|x86_64|mips64] [eng|userdebug|user] - croot: Changes directory to the top of the tree. - m: Makes from the top of the tree. - mm: Builds all of the modules in the current directory, but not their dependencies. @@ -11,6 +11,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y - mma: Builds all of the modules in the current directory, and their dependencies. - mmma: Builds all of the modules in the supplied directories, and their dependencies. - cgrep: Greps on all local C/C++ files. +- ggrep: Greps on all local Gradle files. - jgrep: Greps on all local Java files. - resgrep: Greps on all local res/*.xml files. - godir: Go to the directory containing a file. @@ -35,7 +36,7 @@ function get_abs_build_var() return fi (\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ - make --no-print-directory -f build/core/config.mk dumpvar-abs-$1) + command make --no-print-directory -f build/core/config.mk dumpvar-abs-$1) } # Get the exact value of a build variable. @@ -47,7 +48,7 @@ function get_build_var() return fi (\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ - make --no-print-directory -f build/core/config.mk dumpvar-$1) + command make --no-print-directory -f build/core/config.mk dumpvar-$1) } # check to see if the supplied product is one we can build @@ -204,6 +205,24 @@ function setpaths() unset ANDROID_HOST_OUT export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT) + # If prebuilts/android-emulator/<system>/ exists, prepend it to our PATH + # to ensure that the corresponding 'emulator' binaries are used. + case $(uname -s) in + Darwin) + ANDROID_EMULATOR_PREBUILTS=$T/prebuilts/android-emulator/darwin-x86_64 + ;; + Linux) + ANDROID_EMULATOR_PREBUILTS=$T/prebuilts/android-emulator/linux-x86_64 + ;; + *) + ANDROID_EMULATOR_PREBUILTS= + ;; + esac + if [ -n "$ANDROID_EMULATOR_PREBUILTS" -a -d "$ANDROID_EMULATOR_PREBUILTS" ]; then + PATH=$ANDROID_EMULATOR_PREBUILTS:$PATH + export ANDROID_EMULATOR_PREBUILTS + fi + # needed for building linux on MacOS # TODO: fix the path #export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include @@ -564,12 +583,12 @@ function _lunch() complete -F _lunch lunch # Configures the build to build unbundled apps. -# Run tapas with one ore more app names (from LOCAL_PACKAGE_NAME) +# Run tapas with one or more app names (from LOCAL_PACKAGE_NAME) function tapas() { - local arch=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|mips|armv5)$')) - local variant=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$')) - local apps=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|arm|x86|mips|armv5)$')) + local arch="$(echo $* | xargs -n 1 echo | \grep -E '^(arm|x86|mips|armv5|arm64|x86_64|mips64)$' | xargs)" + local variant="$(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$' | xargs)" + local apps="$(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng|arm|x86|mips|armv5|arm64|x86_64|mips64)$' | xargs)" if [ $(echo $arch | wc -w) -gt 1 ]; then echo "tapas: Error: Multiple build archs supplied: $arch" @@ -582,9 +601,12 @@ function tapas() local product=full case $arch in - x86) product=full_x86;; - mips) product=full_mips;; - armv5) product=generic_armv5;; + x86) product=full_x86;; + mips) product=full_mips;; + armv5) product=generic_armv5;; + arm64) product=aosp_arm64;; + x86_64) product=aosp_x86_64;; + mips64) product=aosp_mips64;; esac if [ -z "$variant" ]; then variant=eng @@ -1035,6 +1057,7 @@ function gdbclient() fi OUT_SO_SYMBOLS=$OUT_SO_SYMBOLS$USE64BIT + OUT_VENDOR_SO_SYMBOLS=$OUT_VENDOR_SO_SYMBOLS$USE64BIT echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS" echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS:$OUT_SO_SYMBOLS/hw:$OUT_SO_SYMBOLS/ssl/engines:$OUT_SO_SYMBOLS/drm:$OUT_SO_SYMBOLS/egl:$OUT_SO_SYMBOLS/soundfx:$OUT_VENDOR_SO_SYMBOLS:$OUT_VENDOR_SO_SYMBOLS/hw:$OUT_VENDOR_SO_SYMBOLS/egl" @@ -1082,6 +1105,11 @@ function gettargetarch get_build_var TARGET_ARCH } +function ggrep() +{ + find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.gradle" -print0 | xargs -0 grep --color -n "$@" +} + function jgrep() { find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@" @@ -1217,9 +1245,7 @@ function runhat() fi # issue "am" command to cause the hprof dump - local sdcard=$(adb ${adbOptions} shell echo -n '$EXTERNAL_STORAGE') - local devFile=$sdcard/hprof-$targetPid - #local devFile=/data/local/hprof-$targetPid + local devFile=/data/local/tmp/hprof-$targetPid echo "Poking $targetPid and waiting for data..." echo "Storing data at $devFile" adb ${adbOptions} shell am dumpheap $targetPid $devFile @@ -1445,6 +1471,36 @@ function pez { return $retval } +function make() +{ + local start_time=$(date +"%s") + command make "$@" + local ret=$? + local end_time=$(date +"%s") + local tdiff=$(($end_time-$start_time)) + local hours=$(($tdiff / 3600 )) + local mins=$((($tdiff % 3600) / 60)) + local secs=$(($tdiff % 60)) + echo + if [ $ret -eq 0 ] ; then + echo -n -e "#### make completed successfully " + else + echo -n -e "#### make failed to build some targets " + fi + if [ $hours -gt 0 ] ; then + printf "(%02g:%02g:%02g (hh:mm:ss))" $hours $mins $secs + elif [ $mins -gt 0 ] ; then + printf "(%02g:%02g (mm:ss))" $mins $secs + elif [ $secs -gt 0 ] ; then + printf "(%s seconds)" $secs + fi + echo -e " ####" + echo + return $ret +} + + + if [ "x$SHELL" != "x/bin/bash" ]; then case `ps -o command -p $$` in *bash*) |