skip soong tests by default for b command

It doesn't really make sense to incur the cost of running Soong tests to
Bazel users. We can shave off 20 seconds from the local critical path
during clean builds (or if Soong itself has changed) by enabling
--skip-soong-tests in the b command.

Test: b build '...'
Test: b build '...' --run-soong-tests
Bug: 240231596
Change-Id: I2325e1992099534b41ae996cee99e126a12f3c62
This commit is contained in:
Sam Delmerico 2022-08-30 10:17:38 -04:00
parent e31d7de7b0
commit e4c74c5eef

View file

@ -1838,10 +1838,20 @@ 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 bazel_args=""
local skip_tests="--skip-soong-tests"
for i in $@; do
if [[ $i != "--run-soong-tests" ]]; then
bazel_args+="$i "
else
skip_tests=""
fi
done
# Generate BUILD, bzl files into the synthetic Bazel workspace (out/soong/workspace).
_trigger_build "all-modules" bp2build USE_BAZEL_ANALYSIS= || return 1
# Then, run Bazel using the synthetic workspace as the --package_path.
if [[ -z "$@" ]]; then
if [[ -z "$bazel_args" ]]; then
# If there are no args, show help.
bazel help
else
@ -1851,7 +1861,7 @@ function b()
# b run //foo -- --args-for-foo
local config_set=0
local bazel_args_with_config=""
for arg in $@; do
for arg in $bazel_args; do
if [[ $arg == "--" && $config_set -ne 1 ]]; # if we find --, insert config argument here
then
bazel_args_with_config+="--config=bp2build -- "