diff --git a/src/main/starlark/builtins_bzl/common/cc/cc_proto_library.bzl b/src/main/starlark/builtins_bzl/common/cc/cc_proto_library.bzl index 81e8df4be079cd..4d2efef8d21624 100644 --- a/src/main/starlark/builtins_bzl/common/cc/cc_proto_library.bzl +++ b/src/main/starlark/builtins_bzl/common/cc/cc_proto_library.bzl @@ -266,8 +266,8 @@ _cc_proto_aspect = aspect( default = configuration_field(fragment = "proto", name = "proto_toolchain_for_cc"), ), "_cc_toolchain": attr.label(default = "@bazel_tools//tools/cpp:current_cc_toolchain"), - "_cc_toolchain_type": attr.label(default = "@bazel_tools//tools/cpp:toolchain_type"), }, + toolchains = cc_helper.use_cpp_toolchain(), ) def _impl(ctx): diff --git a/src/test/shell/bazel/bazel_proto_library_test.sh b/src/test/shell/bazel/bazel_proto_library_test.sh index c41b4e1e678c13..17c064aac38c90 100755 --- a/src/test/shell/bazel/bazel_proto_library_test.sh +++ b/src/test/shell/bazel/bazel_proto_library_test.sh @@ -565,6 +565,35 @@ EOF bazel build //a:c || fail "build failed" } +function test_cc_proto_library_with_toolchain_resolution() { + write_workspace "" + mkdir -p a + cat > a/BUILD < a/p.proto < a/c.cc <