Revert "skip soong tests by default for b command"

This reverts commit 56e576dc12.

Reason for revert: breaks `b cquery //foo:bar` - it strips out `//foo:bar`.

Change-Id: I92d8b1c2732efad3160d26ee78116eccc9f8e48a
This commit is contained in:
Jingwen Chen
2022-08-30 08:54:06 +00:00
parent 56e576dc12
commit e7b2c97c6a

View File

@@ -1838,17 +1838,10 @@ function _trigger_build()
# Convenience entry point (like m) to use Bazel in AOSP.
function b()
(
# Look for the --run-soong-tests flag and skip passing --skip-soong-tests to Soong if present
local run_tests=$(echo "$@" | grep -ow -- "--run-soong-tests")
local bazel_args=(${@/--run-soong-tests})
local skip_tests="--skip-soong-tests"
if [[ -n $run_tests ]]; then
skip_tests=""
fi
# Generate BUILD, bzl files into the synthetic Bazel workspace (out/soong/workspace).
_trigger_build "all-modules" bp2build USE_BAZEL_ANALYSIS= $skip_tests || return 1
_trigger_build "all-modules" bp2build USE_BAZEL_ANALYSIS= || return 1
# Then, run Bazel using the synthetic workspace as the --package_path.
if [[ -z "$bazel_args" ]]; then
if [[ -z "$@" ]]; then
# If there are no args, show help.
bazel help
else
@@ -1856,23 +1849,17 @@ function b()
# 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 pre_config_args=""
local post_config_args=""
local start_post_config_args=0
for arg in $bazel_args;
local previous_args=""
for arg in $@;
do
if [[ $start_post_config_args -eq 0 ]]; then
pre_config_args+="$arg "
else
post_config_args+="$arg "
fi
previous_args+="$arg "
shift
if [[ $arg != -* ]]; # if $arg doesn't start with a dash
then
start_post_config_args=1
break
fi
done
eval "bazel $pre_config_args --config=bp2build $post_config_args"
bazel $previous_args --config=bp2build $@
fi
)