Skip to content

Commit 0c1211d

Browse files
sroettgercopybara-github
authored andcommitted
Include headers from other packages
PiperOrigin-RevId: 971078626 Change-Id: I36347a173aec2f5fbf7a4b5ccadedcacbc5321e1
1 parent fdbe20e commit 0c1211d

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

sandboxed_api/bazel/sapi.bzl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,12 @@ def _clang_generator_flags(ctx, cc_ctx, cpp_toolchain, input_files_paths):
120120
flags += ["--extra-arg=-I{}".format(d) for d in cc_ctx.includes.to_list()]
121121
return flags
122122

123-
def _lib_direct_headers(lib, cc_ctx):
123+
def _lib_direct_headers(lib):
124124
headers = []
125-
for h in cc_ctx.direct_public_headers:
125+
for h in lib[CcInfo].compilation_context.direct_public_headers:
126126
if h.extension != "h" or "/PROTECTED/" in h.path:
127127
continue
128-
129-
# Include only headers coming from the target
130-
# not ones that it depends on by comparing the label packages.
131-
if (h.owner.package == lib.label.package):
132-
headers.append(h.path)
128+
headers.append(h.path)
133129

134130
return headers
135131

@@ -195,7 +191,7 @@ def _sapi_interface_impl(ctx):
195191
input_files_paths.append(f.path)
196192
else:
197193
# Try to find files automatically
198-
input_files_paths += _lib_direct_headers(ctx.attr.lib, cc_ctx)
194+
input_files_paths += _lib_direct_headers(ctx.attr.lib)
199195

200196
input_files += cpp_toolchain.all_files.to_list()
201197
extra_flags += _clang_generator_flags(ctx, cc_ctx, cpp_toolchain, input_files_paths)
@@ -847,14 +843,14 @@ def _sandboxed_library_gen_impl(ctx):
847843
args.append("--host_src_out={}".format(ctx.outputs.host_src_out.path))
848844
args.append("--sapi_out={}".format(ctx.attr.sapi_hdr))
849845
args.append("--sapi_limit_scan_depth")
850-
args.append("--library_headers=" + ",".join(_lib_direct_headers(ctx.attr.lib, cc_ctx)))
846+
args.append("--library_headers=" + ",".join(_lib_direct_headers(ctx.attr.lib)))
851847

852848
# Note: the srcs files on the cc_sandboxed_library should go first
853849
# b/c they may alter how the library headers are interpreted.
854850
input_files_paths = []
855851
for f in ctx.files.srcs:
856852
input_files_paths.append(f.path)
857-
for f in _lib_direct_headers(ctx.attr.lib, cc_ctx):
853+
for f in _lib_direct_headers(ctx.attr.lib):
858854
input_files_paths.append(f)
859855
args += _clang_generator_flags(ctx, cc_ctx, cpp_toolchain, input_files_paths)
860856
args += input_files_paths

0 commit comments

Comments
 (0)