Rename use_cpp_toolchain in protos/bazel/cc_proto_library.bzl, for consistency.

This now matches the upb_use_cpp_toolchain function name in the equivalent function in third_party/upb/bazel/upb_proto_library_internal/cc_library_func.bzl.

PiperOrigin-RevId: 606257428
pull/15793/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent 73769a030d
commit 2dd2dfaca3
  1. 17
      bazel/upb_proto_library_internal/cc_library_func.bzl
  2. 22
      protos/bazel/upb_cc_proto_library.bzl

@ -4,7 +4,12 @@
# load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
#
# def upb_use_cpp_toolchain():
# return use_cpp_toolchain()
# return [
# config_common.toolchain_type(
# "@bazel_tools//tools/cpp:cc_runtimes_toolchain_type",
# mandatory = False,
# ),
# ] + use_cpp_toolchain()
#
# end:google_only
@ -33,6 +38,16 @@ def cc_library_func(ctx, name, hdrs, srcs, copts, includes, 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)

@ -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_use_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_use_cpp_toolchain(),
)
upb_cc_proto_library = rule(

Loading…
Cancel
Save