Merge "Move the --config flag in the b command earlier" am: f376161d5a am: 88419d2c4f am: ccaf26ae32

Original change: https://android-review.googlesource.com/c/platform/build/+/2190222

Change-Id: Ief7ebf639113178a1e9cc426c226f74f7057b10e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Cole Faust
2022-08-24 03:43:49 +00:00
committed by Automerger Merge Worker

View File

@@ -1846,7 +1846,20 @@ function b()
bazel help
else
# Else, always run with the bp2build configuration, which sets Bazel's package path to the synthetic workspace.
bazel "$@" --config=bp2build
# Add the --config=bp2build after the first argument that doesn't start with a dash. That should be the bazel
# command. (build, test, run, ect) If the --config was added at the end, it wouldn't work with commands like:
# b run //foo -- --args-for-foo
local previous_args=""
for arg in $@;
do
previous_args+="$arg "
shift
if [[ $arg != -* ]]; # if $arg doesn't start with a dash
then
break
fi
done
bazel $previous_args --config=bp2build $@
fi
)