forked from openkylin/platform_build
Add a showcommands function to envsetup.
This is similar to the old `m showcommands`, but operates on specific output paths instead and does not require a build aside from the initial invocation of soong to generate the ninja files. The `--regenerate` option is accepted that causes the ninja file to be regenerated first, but this is not the default because it is slow. Just note that without this flag results may be stale. It unfortunately doesn't work for everything in out. For example, `$OUT/system/lib/libc.so` won't work because it is a symlink that isn't in the build graph, but `$OUT/system/lib/bootstrap/libc.so` works. Test: showcommands out/target/product/walleye/system/lib/libz.so Bug: None Change-Id: I4cfded3db994044870fc71ae4bcf9a69224b1e15
This commit is contained in:
parent
53a80be100
commit
bab814f330
35
envsetup.sh
35
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
|
||||
|
|
Loading…
Reference in New Issue