summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2020-05-06 15:24:44 -0700
committerAndrei Vagin <avagin@google.com>2020-05-07 18:25:32 -0700
commit5d54ddcf03b7ec20514b5d29e8e8820e68d5bab1 (patch)
tree59804e25d9a8fecdc090d469250faea258c6487a /tools
parent5536073969ae1805fc77743e7aac540af6b66a3e (diff)
make: exit with non-zero code if "bazel build" failed
Without this fix, make exits with zero code when bazel build failed: $ make run TARGETS="--abra --kadabra" ERROR: Unrecognized option: --abra $ echo $? 0 Signed-off-by: Andrei Vagin <avagin@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/bazel.mk3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/bazel.mk b/tools/bazel.mk
index 71641970d..dbe0ff77a 100644
--- a/tools/bazel.mk
+++ b/tools/bazel.mk
@@ -34,6 +34,7 @@ FULL_DOCKER_RUN_OPTIONS := $(DOCKER_RUN_OPTIONS)
FULL_DOCKER_RUN_OPTIONS += -v "$(BAZEL_CACHE):$(BAZEL_CACHE)"
FULL_DOCKER_RUN_OPTIONS += -v "$(GCLOUD_CONFIG):$(GCLOUD_CONFIG)"
FULL_DOCKER_RUN_OPTIONS += -v "$(DOCKER_SOCKET):$(DOCKER_SOCKET)"
+SHELL=/bin/bash -o pipefail
##
## Bazel helpers.
@@ -78,7 +79,7 @@ bazel-server: ## Ensures that the server exists. Used as an internal target.
@docker exec $(DOCKER_NAME) true || $(MAKE) bazel-server-start
.PHONY: bazel-server
-build_paths = docker exec --user $(UID):$(GID) -i $(DOCKER_NAME) sh -c 'bazel build $(OPTIONS) $(TARGETS) 2>&1 \
+build_paths = docker exec --user $(UID):$(GID) -i $(DOCKER_NAME) sh -o pipefail -c 'bazel build $(OPTIONS) $(TARGETS) 2>&1 \
| tee /dev/fd/2 \
| grep -E "^ bazel-bin/" \
| awk "{print $$1;}"' \