Use rules_cc to load cc symbols (#4579)
**What type of PR is this?**
Refactor/cleanup
**What does this PR do? Why is it needed?**
These should disappear from @bazel_tools eventually
**Which issues(s) does this PR fix?**
Fixes #
**Other notes for review**
diff --git a/go/private/BUILD.bazel b/go/private/BUILD.bazel
index e18aa94..ed66414 100644
--- a/go/private/BUILD.bazel
+++ b/go/private/BUILD.bazel
@@ -64,10 +64,9 @@
"//go/private/rules:transition",
"@bazel_skylib//lib:paths",
"@bazel_skylib//rules:common_settings",
- "@bazel_tools//tools/build_defs/cc:action_names.bzl",
- "@bazel_tools//tools/cpp:toolchain_utils.bzl",
"@io_bazel_rules_nogo//:scope.bzl",
- "@rules_cc//cc:find_cc_toolchain_bzl", # Transitive dep of @bazel_tools//tools/cpp:toolchain_utils.bzl
+ "@rules_cc//cc:action_names_bzl",
+ "@rules_cc//cc:find_cc_toolchain_bzl",
],
)
diff --git a/go/private/context.bzl b/go/private/context.bzl
index 1b8d6d0..d669983 100644
--- a/go/private/context.bzl
+++ b/go/private/context.bzl
@@ -21,7 +21,7 @@
"BuildSettingInfo",
)
load(
- "@bazel_tools//tools/build_defs/cc:action_names.bzl",
+ "@rules_cc//cc:action_names.bzl",
"CPP_COMPILE_ACTION_NAME",
"CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME",
"CPP_LINK_EXECUTABLE_ACTION_NAME",
@@ -31,8 +31,8 @@
"OBJC_COMPILE_ACTION_NAME",
)
load(
- "@bazel_tools//tools/cpp:toolchain_utils.bzl",
- "find_cpp_toolchain",
+ "@rules_cc//cc:find_cc_toolchain.bzl",
+ "find_cc_toolchain",
)
load(
"@io_bazel_rules_nogo//:scope.bzl",
@@ -79,7 +79,7 @@
CPP_TOOLCHAIN_TYPE = Label("@bazel_tools//tools/cpp:toolchain_type")
CGO_ATTRS = {
- "_cc_toolchain": attr.label(default = "@bazel_tools//tools/cpp:optional_current_cc_toolchain"),
+ "_cc_toolchain": attr.label(default = "@rules_cc//cc:optional_current_cc_toolchain"),
"_xcode_config": attr.label(default = configuration_field(fragment = "apple", name = "xcode_config_label")),
"_pure_flag": attr.label(default = "//go/config:pure"),
"_pure_constraint": attr.label(default = "//go/toolchain:cgo_off"),
@@ -794,7 +794,7 @@
# toolchain (to be inputs into actions that need it).
# ctx.files._cc_toolchain won't work when cc toolchain resolution
# is switched on.
- cc_toolchain = find_cpp_toolchain(ctx, mandatory = False)
+ cc_toolchain = find_cc_toolchain(ctx, mandatory = False)
if not cc_toolchain or cc_toolchain.compiler in _UNSUPPORTED_C_COMPILERS:
return None