Merge "Add a showcommands function to envsetup."

This commit is contained in:
Treehugger Robot 2020-09-17 04:35:33 +00:00 committed by Gerrit Code Review
commit 00daf9d906

View file

@ -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