summaryrefslogtreecommitdiffhomepage
path: root/tools/bazel.mk
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2021-01-05 18:52:55 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-05 18:55:05 -0800
commita1e3845b65c266fe083e67811657bb7b764c4413 (patch)
tree625c06da0aab7face5769af46c344c23914bab0c /tools/bazel.mk
parentab32fa2481d84e3f390f2cd81e25c537756b7aa1 (diff)
Make build command more robust.
This returns all targets, and handles no targets. PiperOrigin-RevId: 350263578
Diffstat (limited to 'tools/bazel.mk')
-rw-r--r--tools/bazel.mk12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/bazel.mk b/tools/bazel.mk
index 9b8def713..a0246a560 100644
--- a/tools/bazel.mk
+++ b/tools/bazel.mk
@@ -189,13 +189,13 @@ build_paths = \
(set -euo pipefail; \
$(call wrapper,$(BAZEL) build $(BASE_OPTIONS) $(1)) 2>&1 \
| tee /proc/self/fd/2 \
- | grep -A1 -E '^Target' \
- | grep -E '^ ($(subst $(SPACE),|,$(BUILD_ROOTS)))' \
- | sed "s/ /\n/g" \
- | strings -n 10 \
+ | sed -n -e '/^Target/,$$p' \
+ | sed -n -e '/^ \($(subst /,\/,$(subst $(SPACE),\|,$(BUILD_ROOTS)))\)/p' \
+ | sed -e 's/ /\n/g' \
| awk '{$$1=$$1};1' \
- | xargs -n 1 -I {} readlink -f "{}" \
- | xargs -n 1 -I {} bash -c 'set -xeuo pipefail; $(2)')
+ | strings \
+ | xargs -r -n 1 -I {} readlink -f "{}" \
+ | xargs -r -n 1 -I {} bash -c 'set -xeuo pipefail; $(2)')
clean = $(call header,CLEAN) && $(call wrapper,$(BAZEL) clean)
build = $(call header,BUILD $(1)) && $(call build_paths,$(1),echo {})