Merge "Move the --config flag in the b command earlier"

This commit is contained in:
Cole Faust
2022-08-24 00:31:52 +00:00
committed by Gerrit Code Review

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
)