Skip to content

Commit cefa68b

Browse files
committed
Migrate usages of py_internal.cc_helper to @rules_cc
1 parent b3d9b42 commit cefa68b

7 files changed

Lines changed: 19 additions & 18 deletions

File tree

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module(
66

77
bazel_dep(name = "bazel_features", version = "1.21.0")
88
bazel_dep(name = "bazel_skylib", version = "1.8.2")
9-
bazel_dep(name = "rules_cc", version = "0.1.5")
9+
bazel_dep(name = "rules_cc", version = "0.2.0")
1010
bazel_dep(name = "platforms", version = "0.0.11")
1111

1212
# Those are loaded only when using py_proto_library

WORKSPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ load("//:internal_dev_setup.bzl", "rules_python_internal_setup")
6868

6969
rules_python_internal_setup()
7070

71+
load("@rules_cc//cc:extensions.bzl", _cc_compatibility_proxy_repo = "compatibility_proxy_repo")
72+
73+
_cc_compatibility_proxy_repo()
74+
7175
load("@pythons_hub//:versions.bzl", "PYTHON_VERSIONS")
7276
load("//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains")
7377

internal_dev_deps.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ def rules_python_internal_deps():
238238

239239
http_archive(
240240
name = "rules_cc",
241-
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.1.5/rules_cc-0.1.5.tar.gz"],
242-
sha256 = "b8b918a85f9144c01f6cfe0f45e4f2838c7413961a8ff23bc0c6cdf8bb07a3b6",
243-
strip_prefix = "rules_cc-0.1.5",
241+
sha256 = "ae244f400218f4a12ee81658ff246c0be5cb02c5ca2de5519ed505a6795431e9",
242+
strip_prefix = "rules_cc-0.2.0",
243+
url = "https://github.com/bazelbuild/rules_cc/releases/download/0.2.0/rules_cc-0.2.0.tar.gz",
244244
)
245245

246246
http_archive(

python/private/BUILD.bazel

Lines changed: 4 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,9 @@ bzl_library(
422415
"@bazel_skylib//lib:paths",
423416
"@bazel_skylib//lib:structs",
424417
"@bazel_skylib//rules:common_settings",
418+
"@rules_cc//cc:find_cc_toolchain_bzl",
419+
"@rules_cc//cc/common",
420+
"@rules_cc//cc/common:cc_helper_bzl",
425421
],
426422
)
427423

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: 3 additions & 2 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("@rules_python_internal//:rules_python_config.bzl", rp_config = "config")
2224
load(":attr_builders.bzl", "attrb")
2325
load(
@@ -33,7 +35,6 @@ load(
3335
"apply_config_settings_attr",
3436
)
3537
load(":builders.bzl", "builders")
36-
load(":cc_helper.bzl", "cc_helper")
3738
load(
3839
":common.bzl",
3940
"collect_cc_info",
@@ -1435,7 +1436,7 @@ def _write_build_data(ctx, central_uncachable_version_file, extra_write_build_da
14351436
# https://github.com/bazelbuild/bazel/issues/9363
14361437
"INFO_FILE": ctx.info_file.path,
14371438
"OUTPUT": build_data.path,
1438-
"PLATFORM": cc_helper.find_cpp_toolchain(ctx).toolchain_id,
1439+
"PLATFORM": find_cc_toolchain(ctx).toolchain_id,
14391440
"TARGET": str(ctx.label),
14401441
"VERSION_FILE": version_file.path,
14411442
}, extra_write_build_data_env),

python/private/py_repositories.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def py_repositories(transition_settings = []):
6868
)
6969
http_archive(
7070
name = "rules_cc",
71-
sha256 = "b8b918a85f9144c01f6cfe0f45e4f2838c7413961a8ff23bc0c6cdf8bb07a3b6",
72-
strip_prefix = "rules_cc-0.1.5",
73-
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.1.5/rules_cc-0.1.5.tar.gz"],
71+
sha256 = "ae244f400218f4a12ee81658ff246c0be5cb02c5ca2de5519ed505a6795431e9",
72+
strip_prefix = "rules_cc-0.2.0",
73+
url = "https://github.com/bazelbuild/rules_cc/releases/download/0.2.0/rules_cc-0.2.0.tar.gz",
7474
)
7575

7676
# Needed by rules_cc, triggered by @rules_java_prebuilt in Bazel by using @rules_cc//cc:defs.bzl

0 commit comments

Comments
 (0)