diff --git a/bazel/private/upb_proto_library_internal/cc_library_func.bzl b/bazel/private/upb_proto_library_internal/cc_library_func.bzl index 6a89fb67ce..76877810c7 100644 --- a/bazel/private/upb_proto_library_internal/cc_library_func.bzl +++ b/bazel/private/upb_proto_library_internal/cc_library_func.bzl @@ -1,9 +1,11 @@ """A function to compile C/C++ code, like cc_library() but from Starlark.""" +load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain") + # begin:google_only -# load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain") # # def upb_use_cpp_toolchain(): +# # TODO: We shouldn't need to add this to the result of use_cpp_toolchain(). # return [ # config_common.toolchain_type( # "@bazel_tools//tools/cpp:cc_runtimes_toolchain_type", @@ -14,11 +16,8 @@ # 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 upb_use_cpp_toolchain(): - return ["@bazel_tools//tools/cpp:toolchain_type"] + return use_cpp_toolchain() # end:github_only diff --git a/protos/bazel/upb_cc_proto_library.bzl b/protos/bazel/upb_cc_proto_library.bzl index b93dfbd9fa..f88ed28b81 100644 --- a/protos/bazel/upb_cc_proto_library.bzl +++ b/protos/bazel/upb_cc_proto_library.bzl @@ -10,11 +10,13 @@ """ load("@bazel_skylib//lib:paths.bzl", "paths") +load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain") +load("//bazel:upb_proto_library.bzl", "GeneratedSrcsInfo", "UpbWrappedCcInfo", "upb_proto_library_aspect") # begin:google_only -# load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain") # # def upb_use_cpp_toolchain(): +# # TODO: We shouldn't need to add this to the result of use_cpp_toolchain(). # return [ # config_common.toolchain_type( # "@bazel_tools//tools/cpp:cc_runtimes_toolchain_type", @@ -23,26 +25,15 @@ load("@bazel_skylib//lib:paths.bzl", "paths") # ] + 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") -load("//bazel:upb_proto_library.bzl", "GeneratedSrcsInfo", "UpbWrappedCcInfo", "upb_proto_library_aspect") +# begin:github_only def upb_use_cpp_toolchain(): - return ["@bazel_tools//tools/cpp:toolchain_type"] + return use_cpp_toolchain() # end:github_only # Generic support code ######################################################### -# begin:github_only -_is_google3 = False -# end:github_only - -# begin:google_only -# _is_google3 = True -# end:google_only - def _get_real_short_path(file): # For some reason, files from other archives have short paths that look like: # ../com_google_protobuf/google/protobuf/descriptor.proto