diff --git a/envsetup.sh b/envsetup.sh index 2d670c4001..550dca86bb 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -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 -- "