Skip to content

Commit b81a4f4

Browse files
comiuscopybara-github
authored andcommitted
Enable C++ symbols using compatiblity proxy
PiperOrigin-RevId: 823465606 Change-Id: I4f9654e6081d01a7a8c3bb4f2357de49d20a0ede
1 parent d9f1178 commit b81a4f4

18 files changed

+114
-19
lines changed

cc/BUILD

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ filegroup(
5555
srcs = glob([
5656
"**/*.bzl",
5757
]) + [
58-
"//cc/private/rules_impl:bzl_srcs",
59-
"//cc/private/toolchain:bzl_srcs",
58+
"//cc/private:bzl_srcs",
6059
],
6160
visibility = ["//visibility:public"],
6261
)
@@ -67,8 +66,7 @@ filegroup(
6766
"**/*.bzl",
6867
"**/BUILD",
6968
]) + [
70-
"//cc/private/rules_impl:srcs",
71-
"//cc/private/toolchain:srcs",
69+
"//cc/private:srcs",
7270
],
7371
visibility = ["//visibility:public"],
7472
)

cc/common/cc_common.bzl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
"""cc_common module"""
1615

17-
load("//cc/private/rules_impl:native.bzl", "native_cc_common")
16+
load("@cc_compatibility_proxy//:symbols.bzl", _cc_common = "cc_common")
1817

19-
cc_common = native_cc_common
18+
cc_common = _cc_common

cc/common/cc_info.bzl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
1514
"""CcInfo"""
1615

17-
load("//cc/private/rules_impl:native.bzl", "NativeCcInfo")
16+
load("@cc_compatibility_proxy//:symbols.bzl", _CcInfo = "CcInfo")
1817

19-
CcInfo = NativeCcInfo
18+
CcInfo = _CcInfo

cc/common/debug_package_info.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# limitations under the License.
1414
"""DebugPackageInfo"""
1515

16-
load("//cc/private/rules_impl:native.bzl", "NativeDebugPackageInfo")
16+
load("@cc_compatibility_proxy//:symbols.bzl", _DebugPackageInfo = "DebugPackageInfo")
1717

18-
DebugPackageInfo = NativeDebugPackageInfo
18+
DebugPackageInfo = _DebugPackageInfo

cc/extensions.bzl

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ def _compatibility_proxy_repo_impl(rctx):
3535
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
3636
bzl_library(
3737
name = "proxy_bzl",
38-
srcs = ["proxy.bzl"],
38+
srcs = ["proxy.bzl", "symbols.bzl"],
3939
deps = [
4040
"@rules_cc//cc/private/rules_impl:core_rules",
4141
"@rules_cc//cc/private/rules_impl:toolchain_rules",
42+
"@rules_cc//cc/private:cc_common",
4243
],
4344
visibility = ["@rules_cc//cc:__subpackages__"],
4445
)
@@ -80,14 +81,28 @@ cc_toolchain_alias = _cc_toolchain_alias
8081
CcSharedLibraryInfo = _CcSharedLibraryInfo
8182
""",
8283
)
84+
rctx.file(
85+
"symbols.bzl",
86+
"""
87+
load("@rules_cc//cc/private:cc_common.bzl", _cc_common = "cc_common")
88+
load("@rules_cc//cc/private:cc_info.bzl", _CcInfo = "CcInfo")
89+
load("@rules_cc//cc/private/toolchain_config:cc_toolchain_config_info.bzl", _CcToolchainConfigInfo = "CcToolchainConfigInfo")
90+
load("@rules_cc//cc/private:debug_package_info.bzl", _DebugPackageInfo = "DebugPackageInfo")
91+
92+
cc_common = _cc_common
93+
CcInfo = _CcInfo
94+
DebugPackageInfo = _DebugPackageInfo
95+
CcToolchainConfigInfo = _CcToolchainConfigInfo
96+
""",
97+
)
8398
else:
8499
rctx.file(
85100
"BUILD",
86101
"""
87102
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
88103
bzl_library(
89104
name = "proxy_bzl",
90-
srcs = ["proxy.bzl"],
105+
srcs = ["proxy.bzl", "symbols.bzl"],
91106
deps = ["@rules_cc//cc/private/rules_impl:native_bzl"],
92107
visibility = ["@rules_cc//cc:__subpackages__"],
93108
)
@@ -115,6 +130,21 @@ cc_toolchain_alias = native.cc_toolchain_alias
115130
CcSharedLibraryInfo = NativeCcSharedLibraryInfo
116131
""",
117132
)
133+
rctx.file(
134+
"symbols.bzl",
135+
"""
136+
load("@rules_cc//cc/private/rules_impl:native.bzl", "native_cc_common")
137+
load("@rules_cc//cc/private/rules_impl:native.bzl", "NativeCcInfo")
138+
load("@rules_cc//cc/private/rules_impl:native.bzl", "NativeDebugPackageInfo")
139+
load("@rules_cc//cc/private/rules_impl:native.bzl", "NativeCcToolchainConfigInfo")
140+
load("@rules_cc//cc/private/rules_impl:native.bzl", "NativeCcSharedLibraryInfo")
141+
142+
cc_common = native_cc_common
143+
CcInfo = NativeCcInfo
144+
DebugPackageInfo = NativeDebugPackageInfo
145+
CcToolchainConfigInfo = NativeCcToolchainConfigInfo
146+
""",
147+
)
118148

119149
_compatibility_proxy_repo_rule = repository_rule(
120150
_compatibility_proxy_repo_impl,

cc/find_cc_toolchain.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ CC_TOOLCHAIN_ATTRS = {
6363

6464
def find_cc_toolchain(ctx, *, mandatory = True):
6565
"""
66-
Returns the current `CcToolchainInfo`.
66+
Returns the current `CcToolchainInfo`.
6767
6868
Args:
6969
ctx: The rule context for which to find a toolchain.

cc/private/BUILD

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414

1515
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
1616

17+
filegroup(
18+
name = "bzl_srcs",
19+
srcs = glob([
20+
"**/*.bzl",
21+
]) + [
22+
"//cc/private/compile:bzl_srcs",
23+
"//cc/private/link:bzl_srcs",
24+
"//cc/private/rules_impl:bzl_srcs",
25+
"//cc/private/toolchain:bzl_srcs",
26+
"//cc/private/toolchain_config:bzl_srcs",
27+
],
28+
visibility = ["//visibility:public"],
29+
)
30+
1731
filegroup(
1832
name = "srcs",
1933
srcs = glob([
@@ -35,6 +49,32 @@ bzl_library(
3549
visibility = ["//cc:__subpackages__"],
3650
)
3751

52+
bzl_library(
53+
name = "cc_common",
54+
srcs = ["cc_common.bzl"],
55+
visibility = [
56+
"//cc:__subpackages__",
57+
"@cc_compatibility_proxy//:__pkg__",
58+
],
59+
deps = [
60+
":cc_info_bzl",
61+
":cc_internal_bzl",
62+
":cc_launcher_info_bzl",
63+
":cc_shared_library_hint_info_bzl",
64+
":debug_package_info_bzl",
65+
"//cc/private/compile:compile_bzl",
66+
"//cc/private/link:link_bzl",
67+
"//cc/private/rules_impl:native_bzl",
68+
"//cc/private/toolchain_config:toolchain_config_bzl",
69+
],
70+
)
71+
72+
bzl_library(
73+
name = "cc_info_bzl",
74+
srcs = ["cc_info.bzl"],
75+
visibility = ["//cc:__subpackages__"],
76+
)
77+
3878
bzl_library(
3979
name = "debug_package_info_bzl",
4080
srcs = ["debug_package_info.bzl"],

cc/private/compile/BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ bzl_library(
2727
],
2828
)
2929

30+
filegroup(
31+
name = "bzl_srcs",
32+
srcs = glob([
33+
"**/*.bzl",
34+
]),
35+
visibility = ["//visibility:public"],
36+
)
37+
3038
filegroup(
3139
name = "srcs",
3240
srcs = glob([

cc/private/link/BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ bzl_library(
2828
],
2929
)
3030

31+
filegroup(
32+
name = "bzl_srcs",
33+
srcs = glob([
34+
"**/*.bzl",
35+
]),
36+
visibility = ["//visibility:public"],
37+
)
38+
3139
filegroup(
3240
name = "srcs",
3341
srcs = glob([

cc/private/rules_impl/cc_toolchain_info.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Definition of CcToolchainInfo provider.
1616
"""
1717

18-
visibility(["//third_party/bazel_rules/rules_cc/..."])
18+
visibility(["//cc/..."])
1919

2020
def _needs_pic_for_dynamic_libraries(*, feature_configuration):
2121
return feature_configuration.is_enabled("supports_pic")

0 commit comments

Comments
 (0)