@ -15,12 +15,20 @@ load("//bazel:upb_proto_library.bzl", "GeneratedSrcsInfo", "UpbWrappedCcInfo", "
# begin:google_only
# load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
#
# def upb_use_cpp_toolchain():
# return [
# config_common.toolchain_type(
# "@bazel_tools//tools/cpp:cc_runtimes_toolchain_type",
# mandatory = False,
# ),
# ] + use_cpp_toolchain()
#
# end:google_only
# begin:github_only
# Compatibility code for Bazel 4.x. Remove this when we drop support for Bazel 4.x.
load ( " @bazel_tools//tools/cpp:toolchain_utils.bzl " , " find_cpp_toolchain " )
def use_cpp_toolchain ( ) :
def upb_u se_cpp_toolchain ( ) :
return [ " @bazel_tools//tools/cpp:toolchain_type " ]
# end:github_only
@ -85,6 +93,16 @@ def _cc_library_func(ctx, name, hdrs, srcs, copts, dep_ccinfos):
CcInfo provider for this compilation .
"""
# begin:google_only
# cc_runtimes_toolchain = ctx.toolchains["@bazel_tools//tools/cpp:cc_runtimes_toolchain_type"]
# if cc_runtimes_toolchain:
# dep_ccinfos += [
# target[CcInfo]
# for target in cc_runtimes_toolchain.cc_runtimes_info.runtimes
# ]
#
# end:google_only
compilation_contexts = [ info . compilation_context for info in dep_ccinfos ]
linking_contexts = [ info . linking_context for info in dep_ccinfos ]
toolchain = find_cpp_toolchain ( ctx )
@ -267,7 +285,7 @@ _upb_cc_proto_library_aspect = aspect(
] ,
attr_aspects = [ " deps " ] ,
fragments = [ " cpp " ] ,
toolchains = use_cpp_toolchain ( ) ,
toolchains = upb_u se_cpp_toolchain ( ) ,
)
upb_cc_proto_library = rule (