Skip to content

Commit 0ad5159

Browse files
committed
clean: Remove uses of native C++ implementation
All uses need to be through rules_cc, because C++ will be removed from Bazel.
1 parent 3c3e0be commit 0ad5159

File tree

4 files changed

+9
-37
lines changed

4 files changed

+9
-37
lines changed

python/private/BUILD.bazel

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,17 @@ bzl_library(
118118
srcs = ["bzlmod_enabled.bzl"],
119119
)
120120

121-
bzl_library(
122-
name = "cc_helper_bzl",
123-
srcs = ["cc_helper.bzl"],
124-
deps = [":py_internal_bzl"],
125-
)
126-
127121
bzl_library(
128122
name = "common_bzl",
129123
srcs = ["common.bzl"],
130124
deps = [
131-
":cc_helper_bzl",
132125
":py_cc_link_params_info_bzl",
133126
":py_info_bzl",
134127
":py_internal_bzl",
135128
":reexports_bzl",
136129
":rules_cc_srcs_bzl",
137130
"@bazel_skylib//lib:paths",
131+
"@rules_cc//cc/common:cc_helper_bzl",
138132
],
139133
)
140134

@@ -404,7 +398,6 @@ bzl_library(
404398
srcs = ["py_executable.bzl"],
405399
deps = [
406400
":attributes_bzl",
407-
":cc_helper_bzl",
408401
":common_bzl",
409402
":common_labels_bzl",
410403
":flags_bzl",
@@ -422,6 +415,7 @@ bzl_library(
422415
"@bazel_skylib//lib:paths",
423416
"@bazel_skylib//lib:structs",
424417
"@bazel_skylib//rules:common_settings",
418+
"@rules_cc//cc/common:cc_helper_bzl",
425419
],
426420
)
427421

python/private/cc_helper.bzl

Lines changed: 0 additions & 23 deletions
This file was deleted.

python/private/common.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
load("@bazel_skylib//lib:paths.bzl", "paths")
1717
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
18+
load("@rules_cc//cc/common:cc_helper.bzl", "cc_helper")
1819
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
19-
load(":cc_helper.bzl", "cc_helper")
2020
load(":py_cc_link_params_info.bzl", "PyCcLinkParamsInfo")
2121
load(":py_info.bzl", "PyInfo", "PyInfoBuilder")
2222
load(":py_internal.bzl", "py_internal")

python/private/py_executable.bzl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ load("@bazel_skylib//lib:dicts.bzl", "dicts")
1717
load("@bazel_skylib//lib:paths.bzl", "paths")
1818
load("@bazel_skylib//lib:structs.bzl", "structs")
1919
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
20+
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")
2021
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
22+
load("@rules_cc//cc/common:cc_helper.bzl", "cc_helper")
2123
load(":attr_builders.bzl", "attrb")
2224
load(
2325
":attributes.bzl",
@@ -32,7 +34,6 @@ load(
3234
"apply_config_settings_attr",
3335
)
3436
load(":builders.bzl", "builders")
35-
load(":cc_helper.bzl", "cc_helper")
3637
load(
3738
":common.bzl",
3839
"collect_cc_info",
@@ -1092,7 +1093,7 @@ def py_executable_base_impl(ctx, *, semantics, is_test, inherited_environment =
10921093
)
10931094

10941095
def _get_build_info(ctx, cc_toolchain):
1095-
build_info_files = py_internal.cc_toolchain_build_info_files(cc_toolchain)
1096+
build_info_files = cc_toolchain._build_info_files
10961097
if cc_helper.is_stamping_enabled(ctx):
10971098
# Makes the target depend on BUILD_INFO_KEY, which helps to discover stamped targets
10981099
# See b/326620485 for more details.
@@ -1400,7 +1401,7 @@ def _write_build_data(ctx, central_uncachable_version_file, extra_write_build_da
14001401
# https://github.com/bazelbuild/bazel/issues/9363
14011402
"INFO_FILE": ctx.info_file.path,
14021403
"OUTPUT": build_data.path,
1403-
"PLATFORM": cc_helper.find_cpp_toolchain(ctx).toolchain_id,
1404+
"PLATFORM": find_cc_toolchain(ctx).toolchain_id,
14041405
"TARGET": str(ctx.label),
14051406
"VERSION_FILE": version_file.path,
14061407
}, extra_write_build_data_env),
@@ -1444,7 +1445,7 @@ def _get_native_deps_details(ctx, *, semantics, cc_details, is_test):
14441445

14451446
# The regular cc_common.link API can't be used because several
14461447
# args are private-use only; see # private comments
1447-
py_internal.link(
1448+
getattr(py_internal, "link", cc_common.link)(
14481449
name = ctx.label.name,
14491450
actions = ctx.actions,
14501451
linking_contexts = [cc_info.linking_context],
@@ -1475,7 +1476,7 @@ def _create_shared_native_deps_dso(
14751476
requested_features,
14761477
cc_toolchain):
14771478
linkstamps = [
1478-
py_internal.linkstamp_file(linkstamp)
1479+
linkstamp.file()
14791480
for linker_input in cc_info.linking_context.linker_inputs.to_list()
14801481
for linkstamp in linker_input.linkstamps
14811482
]

0 commit comments

Comments
 (0)