From af1ba906deab331fc4a75efc3b4335cec127e7c2 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Fri, 13 Sep 2024 10:41:05 -0700 Subject: [PATCH] Make C++ proto library work over targets that aren't proto_library PiperOrigin-RevId: 674353486 --- bazel/private/cc_proto_support.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bazel/private/cc_proto_support.bzl b/bazel/private/cc_proto_support.bzl index ba8fd9b52f..3da4420da7 100644 --- a/bazel/private/cc_proto_support.bzl +++ b/bazel/private/cc_proto_support.bzl @@ -95,7 +95,7 @@ def cc_proto_compile_and_link(ctx, deps, sources, headers, disallow_dynamic_libr cc_toolchain = cc_toolchain, srcs = sources, public_hdrs = headers, - compilation_contexts = [dep[CcInfo].compilation_context for dep in deps], + compilation_contexts = [dep[CcInfo].compilation_context for dep in deps if CcInfo in dep], name = ctx.label.name, # Don't instrument the generated C++ files even when --collect_code_coverage is set. # If we actually start generating coverage instrumentation for .proto files based on coverage @@ -113,7 +113,7 @@ def cc_proto_compile_and_link(ctx, deps, sources, headers, disallow_dynamic_libr feature_configuration = feature_configuration, cc_toolchain = cc_toolchain, compilation_outputs = compilation_outputs, - linking_contexts = [dep[CcInfo].linking_context for dep in deps], + linking_contexts = [dep[CcInfo].linking_context for dep in deps if CcInfo in dep], name = ctx.label.name, disallow_dynamic_library = disallow_dynamic_library, alwayslink = alwayslink,