From 06eda49d45a2697e1726e6802759c4fc5c09997c Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Mon, 28 Oct 2024 08:24:04 -0700 Subject: [PATCH] [bazel] fix includes to use proper paths from child packages Also remove a now-unnecessary dependency from the dump_args target that previously had been needed just to get the right includes to be used. PiperOrigin-RevId: 690619490 --- bazel/grpc_build_system.bzl | 14 +++++++++++--- src/core/BUILD | 3 --- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 3cda5a65e31..d49f64281cb 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -146,6 +146,13 @@ def _update_visibility(visibility): final_visibility.append(rule) return [x for x in final_visibility] +def _include_prefix(): + include_prefix = "" + if native.package_name(): + for _ in native.package_name().split("/"): + include_prefix += "../" + return include_prefix + def grpc_cc_library( name, srcs = [], @@ -193,6 +200,7 @@ def grpc_cc_library( if select_deps: for select_deps_entry in select_deps: deps += select(select_deps_entry) + include_prefix = _include_prefix() native.cc_library( name = name, srcs = srcs, @@ -217,9 +225,9 @@ def grpc_cc_library( testonly = testonly, linkopts = linkopts, includes = [ - "include", - "src/core/ext/upb-gen", # Once upb code-gen issue is resolved, remove this. - "src/core/ext/upbdefs-gen", # Once upb code-gen issue is resolved, remove this. + include_prefix + "include", + include_prefix + "src/core/ext/upb-gen", # Once upb code-gen issue is resolved, remove this. + include_prefix + "src/core/ext/upbdefs-gen", # Once upb code-gen issue is resolved, remove this. ], alwayslink = alwayslink, data = data, diff --git a/src/core/BUILD b/src/core/BUILD index 24a4b0ca68a..515391d5fd7 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -65,9 +65,6 @@ grpc_cc_library( "absl/strings:str_format", ], language = "c++", - deps = [ - "//:gpr_platform", - ], ) grpc_cc_library(