diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bazel.mk | 7 | ||||
-rw-r--r-- | tools/bazeldefs/cc.bzl | 12 |
2 files changed, 14 insertions, 5 deletions
diff --git a/tools/bazel.mk b/tools/bazel.mk index af8e53d3f..7e06d09be 100644 --- a/tools/bazel.mk +++ b/tools/bazel.mk @@ -61,6 +61,7 @@ DOCKER_CONFIG := /etc/docker ## STARTUP_OPTIONS - Startup options passed to Bazel. ## STARTUP_OPTIONS := +BAZEL_OPTIONS := BAZEL := bazel $(STARTUP_OPTIONS) BASE_OPTIONS := --color=no --curses=no TEST_OPTIONS := $(BASE_OPTIONS) \ @@ -155,7 +156,7 @@ bazel-image: load-default ## Ensures that the local builder exists. @$(call header,DOCKER BUILD) @docker rm -f $(BUILDER_NAME) 2>/dev/null || true @docker run --user 0:0 --entrypoint "" --name $(BUILDER_NAME) gvisor.dev/images/default \ - sh -c "$(GROUPADD_DOCKER) $(USERADD_DOCKER) if test -e /dev/kvm; then chmod a+rw /dev/kvm; fi" >&2 + bash -c "$(GROUPADD_DOCKER) $(USERADD_DOCKER) if test -e /dev/kvm; then chmod a+rw /dev/kvm; fi" >&2 @docker commit $(BUILDER_NAME) gvisor.dev/images/builder >&2 .PHONY: bazel-image @@ -170,7 +171,7 @@ bazel-server: bazel-image ## Ensures that the server exists. --workdir "$(CURDIR)" \ $(DOCKER_RUN_OPTIONS) \ gvisor.dev/images/builder \ - sh -c "set -x; tail -f --pid=\$$($(BAZEL) info server_pid) /dev/null" >&2 + bash -c "set -x; tail -f --pid=\$$($(BAZEL) info server_pid) /dev/null" >&2 else bazel-server: @ @@ -187,7 +188,7 @@ endif # The last line is used to prevent terminal shenanigans. build_paths = \ (set -euo pipefail; \ - $(call wrapper,$(BAZEL) build $(BASE_OPTIONS) $(1)) 2>&1 \ + $(call wrapper,$(BAZEL) build $(BASE_OPTIONS) $(BAZEL_OPTIONS) $(1)) 2>&1 \ | tee /proc/self/fd/2 \ | sed -n -e '/^Target/,$$p' \ | sed -n -e '/^ \($(subst /,\/,$(subst $(SPACE),\|,$(BUILD_ROOTS)))\)/p' \ diff --git a/tools/bazeldefs/cc.bzl b/tools/bazeldefs/cc.bzl index 7f41a0142..2831eac5f 100644 --- a/tools/bazeldefs/cc.bzl +++ b/tools/bazeldefs/cc.bzl @@ -1,11 +1,9 @@ """C++ rules.""" -load("@bazel_tools//tools/cpp:cc_flags_supplier.bzl", _cc_flags_supplier = "cc_flags_supplier") load("@rules_cc//cc:defs.bzl", _cc_binary = "cc_binary", _cc_library = "cc_library", _cc_proto_library = "cc_proto_library", _cc_test = "cc_test") load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", _cc_grpc_library = "cc_grpc_library") cc_library = _cc_library -cc_flags_supplier = _cc_flags_supplier cc_proto_library = _cc_proto_library cc_test = _cc_test cc_toolchain = "@bazel_tools//tools/cpp:current_cc_toolchain" @@ -14,6 +12,16 @@ gbenchmark = "@com_google_benchmark//:benchmark" grpcpp = "@com_github_grpc_grpc//:grpc++" vdso_linker_option = "-fuse-ld=gold " +def _cc_flags_supplier_impl(ctx): + variables = platform_common.TemplateVariableInfo({ + "CC_FLAGS": "", + }) + return [variables] + +cc_flags_supplier = rule( + implementation = _cc_flags_supplier_impl, +) + def cc_grpc_library(name, **kwargs): _cc_grpc_library(name = name, grpc_only = True, **kwargs) |