Support proto libraries with no headers, whenever that happens. (ihavenoideawhatimdoing.jpg)
PiperOrigin-RevId: 473967082
diff --git a/rs_bindings_from_cc/bazel_support/rust_bindings_from_cc_aspect.bzl b/rs_bindings_from_cc/bazel_support/rust_bindings_from_cc_aspect.bzl
index 253e8b7..9dd1f58 100644
--- a/rs_bindings_from_cc/bazel_support/rust_bindings_from_cc_aspect.bzl
+++ b/rs_bindings_from_cc/bazel_support/rust_bindings_from_cc_aspect.bzl
@@ -106,8 +106,8 @@
elif _is_proto_library(target):
#TODO(b/232199093): Ideally we would get this information from a proto-specific provider,
# but ProtoCcFilesProvider is private currently. Use it once public.
- proto_header = target[CcInfo].compilation_context.direct_headers[0]
- public_hdrs = [proto_header]
+ # (Slicing because e.g. portable_proto_library has an empty direct_headers.)
+ public_hdrs = target[CcInfo].compilation_context.direct_headers[0:1]
all_standalone_hdrs = public_hdrs
extra_rule_specific_deps = [ctx.rule.attr._cc_lib]
elif ctx.rule.kind == "cc_embed_data":