From ef431491364603309fa23cea23b91590705d1dd2 Mon Sep 17 00:00:00 2001 From: Sam Delmerico Date: Mon, 28 Mar 2022 16:06:35 +0000 Subject: [PATCH] add flag to skip soong tests for b command Sometimes it is very handy during testing to temporarily skip Soong tests, but there is not easy method to allow this without changing the envsetup.sh file and re-sourcing before/after enabling/disabling the skip-tests flag. Test: b build '...' --skip-soong-tests Change-Id: I6dcad3ba0336cfd1c4d2c4357b852900792445c3 --- envsetup.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/envsetup.sh b/envsetup.sh index 87e6e0ac54..7331d5ec27 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1727,15 +1727,17 @@ function _trigger_build() # Convenience entry point (like m) to use Bazel in AOSP. function b() ( + local skip_tests=$(echo "$@" | grep -ow -- "--skip-soong-tests") + local bazel_args=(${@/--skip-soong-tests/}) # Generate BUILD, bzl files into the synthetic Bazel workspace (out/soong/workspace). - _trigger_build "all-modules" bp2build USE_BAZEL_ANALYSIS= || return 1 + _trigger_build "all-modules" bp2build USE_BAZEL_ANALYSIS= "$skip_tests" || 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 # Else, always run with the bp2build configuration, which sets Bazel's package path to the synthetic workspace. - bazel "$@" --config=bp2build + bazel $bazel_args --config=bp2build fi )