aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJingwen Chen <jingwen@google.com>2021-06-16 09:44:26 +0000
committerJingwen Chen <jingwen@google.com>2021-06-16 09:44:57 +0000
commit69f9ed14a9aa0313f55b348d1246891bbd310bf1 (patch)
tree8a8c281a75b81d544c68e27e79a466bc594fb8d6
parent757e2e1fc10d92ceae13d653c2e93ebd571e5a68 (diff)
downloadbuild-69f9ed14a9aa0313f55b348d1246891bbd310bf1.tar.gz
Show bazel help for `b` called without args.
This is less surprising than trying to use --config=bp2build as the only args, which is invalid. Test: source build/envsetup.sh; b Change-Id: I0b3724d05b8cc149268e660eb672192fe9bad19d
-rw-r--r--envsetup.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/envsetup.sh b/envsetup.sh
index bbb18e5f5c..c6151559c4 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1696,12 +1696,19 @@ function _trigger_build()
fi
)
+# Convenience entry point (like m) to use Bazel in AOSP.
function b()
(
# Generate BUILD, bzl files into the synthetic Bazel workspace (out/soong/workspace).
m nothing GENERATE_BAZEL_FILES=true || return 1
# Then, run Bazel using the synthetic workspace as the --package_path.
- "$(gettop)/tools/bazel" "$@" --config=bp2build
+ if [[ -z "$@" ]]; then
+ # If there are no args, show help.
+ "$(gettop)/tools/bazel" help
+ else
+ # Else, always run with the bp2build configuration, which sets Bazel's package path to the synthetic workspace.
+ "$(gettop)/tools/bazel" "$@" --config=bp2build
+ fi
)
function m()