diff --git a/envsetup.sh b/envsetup.sh index e98103497..abe1eabb2 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1613,6 +1613,41 @@ function source_vendorsetup() { done } +function showcommands() { + local T=$(gettop) + if [[ -z "$TARGET_PRODUCT" ]]; then + >&2 echo "TARGET_PRODUCT not set. Run lunch." + return + fi + case $(uname -s) in + Darwin) + PREBUILT_NAME=darwin-x86 + ;; + Linux) + PREBUILT_NAME=linux-x86 + ;; + *) + >&2 echo Unknown host $(uname -s) + return + ;; + esac + if [[ -z "$OUT_DIR" ]]; then + if [[ -z "$OUT_DIR_COMMON_BASE" ]]; then + OUT_DIR=out + else + OUT_DIR=${OUT_DIR_COMMON_BASE}/${PWD##*/} + fi + fi + if [[ "$1" == "--regenerate" ]]; then + shift 1 + NINJA_ARGS="-t commands $@" m + else + (cd $T && prebuilts/build-tools/$PREBUILT_NAME/bin/ninja \ + -f $OUT_DIR/combined-${TARGET_PRODUCT}.ninja \ + -t commands "$@") + fi +} + validate_current_shell source_vendorsetup addcompletions