Move the --config flag in the b command earlier
Having the --config flag at the end of a bazel command will make it get passed to the command you're running with b run instead of bazel. Fixes: 242759256 Test: Manually Change-Id: I6d23a0b022fdee5f822a873c1578674d1eab39c0
This commit is contained in:
15
envsetup.sh
15
envsetup.sh
@@ -1846,7 +1846,20 @@ function b()
|
|||||||
bazel help
|
bazel help
|
||||||
else
|
else
|
||||||
# Else, always run with the bp2build configuration, which sets Bazel's package path to the synthetic workspace.
|
# 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
|
fi
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user