Skip to content

Commit 693fd32

Browse files
hvadehracopybara-github
authored andcommitted
Fix bzl_library deps for //cc/common
Copybara Import from #513 BEGIN_PUBLIC Fix bzl_library deps for `//cc/common` (#513) Broken by b81a4f4 Closes #513 END_PUBLIC PiperOrigin-RevId: 827898310 Change-Id: I72f929c48cac16911ae23e8ec6d6a9d1f14d51ca
1 parent a8f6a92 commit 693fd32

File tree

10 files changed

+97
-9
lines changed

10 files changed

+97
-9
lines changed

cc/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ bzl_library(
118118
deps = [
119119
":core_rules",
120120
"//cc/common",
121+
"//cc/common:cc_helper_bzl",
121122
"//cc/private/rules_impl:failing_cc_proto_library_bzl",
122123
"//cc/toolchains:toolchain_rules",
123124
],

cc/common/BUILD

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,28 @@
1313
# limitations under the License.
1414

1515
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
16+
load("//cc:starlark_doc_extract_helper.bzl", "starlark_doc_extract_helper")
1617

1718
bzl_library(
1819
name = "common",
19-
srcs = glob(["*.bzl"]),
20+
srcs = glob(
21+
["*.bzl"],
22+
exclude = [
23+
"cc_helper.bzl",
24+
"cc_debug_helper.bzl",
25+
"visibility.bzl",
26+
"semantics.bzl",
27+
"cc_helper_internal.bzl",
28+
"cc_shared_library_info.bzl",
29+
],
30+
),
2031
visibility = ["//visibility:public"],
2132
deps = [
2233
"//cc/private:cc_internal_bzl",
2334
"//cc/private:paths_bzl",
2435
"//cc/private/rules_impl:native_bzl",
36+
"@bazel_skylib//lib:paths",
37+
"@cc_compatibility_proxy//:symbols_bzl",
2538
],
2639
)
2740

@@ -36,6 +49,32 @@ bzl_library(
3649
],
3750
)
3851

52+
bzl_library(
53+
name = "cc_shared_library_info_bzl",
54+
srcs = ["cc_shared_library_info.bzl"],
55+
visibility = ["//cc:__subpackages__"],
56+
deps = [
57+
"@cc_compatibility_proxy//:proxy_bzl",
58+
],
59+
)
60+
61+
bzl_library(
62+
name = "semantics_bzl",
63+
srcs = ["semantics.bzl"],
64+
visibility = ["//cc:__subpackages__"],
65+
)
66+
67+
bzl_library(
68+
name = "cc_helper_internal_bzl",
69+
srcs = ["cc_helper_internal.bzl"],
70+
visibility = ["//cc:__subpackages__"],
71+
deps = [
72+
"//cc/private:cc_internal_bzl",
73+
"//cc/private:paths_bzl",
74+
"@bazel_skylib//lib:paths",
75+
],
76+
)
77+
3978
bzl_library(
4079
name = "cc_debug_helper_bzl",
4180
srcs = ["cc_debug_helper.bzl"],
@@ -61,3 +100,23 @@ filegroup(
61100
]),
62101
visibility = ["//visibility:public"],
63102
)
103+
104+
# unused targets to test that we have the right bzl_library graph
105+
[starlark_doc_extract_helper(
106+
name = f + "_doc_extract",
107+
src = f,
108+
visibility = ["//visibility:private"],
109+
deps = [
110+
":common",
111+
],
112+
) for f in glob(
113+
["*.bzl"],
114+
exclude = [
115+
"cc_helper.bzl",
116+
"cc_debug_helper.bzl",
117+
"visibility.bzl",
118+
"semantics.bzl",
119+
"cc_helper_internal.bzl",
120+
"cc_shared_library_info.bzl",
121+
],
122+
)]

cc/common/cc_helper_internal.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ def is_stamping_enabled(ctx):
283283
ctx: The rule context.
284284
285285
Returns:
286-
(int): 1: Always stamp the build information into the binary, even in [--nostamp][stamp] builds.
286+
(int) Possible values are:
287+
1: Always stamp the build information into the binary, even in [--nostamp][stamp] builds.
287288
This setting should be avoided, since it potentially kills remote caching for the binary and
288289
any downstream actions that depend on it.
289290
0: Always replace build information by constant values. This gives good build result caching.
@@ -348,6 +349,7 @@ def root_relative_path(file):
348349
349350
Args:
350351
file: (File) The file to get the root-relative path for.
352+
351353
Returns:
352354
(str) The root-relative path of the file.
353355
"""

cc/extensions.bzl

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,22 @@ 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", "symbols.bzl"],
38+
srcs = ["proxy.bzl"],
3939
deps = [
4040
"@rules_cc//cc/private/rules_impl:core_rules",
4141
"@rules_cc//cc/private/rules_impl:toolchain_rules",
4242
"@rules_cc//cc/private:cc_common",
4343
],
4444
visibility = ["@rules_cc//cc:__subpackages__"],
45+
)
46+
bzl_library(
47+
name = "symbols_bzl",
48+
srcs = ["symbols.bzl"],
49+
deps = [
50+
"@rules_cc//cc/private:cc_common",
51+
"@rules_cc//cc/private/toolchain_config:toolchain_config_bzl",
52+
],
53+
visibility = ["@rules_cc//cc:__subpackages__"],
4554
)
4655
""",
4756
)
@@ -105,7 +114,13 @@ new_objc_provider = _ObjcInfo
105114
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
106115
bzl_library(
107116
name = "proxy_bzl",
108-
srcs = ["proxy.bzl", "symbols.bzl"],
117+
srcs = ["proxy.bzl"],
118+
deps = ["@rules_cc//cc/private/rules_impl:native_bzl"],
119+
visibility = ["@rules_cc//cc:__subpackages__"],
120+
)
121+
bzl_library(
122+
name = "symbols_bzl",
123+
srcs = ["symbols.bzl"],
109124
deps = ["@rules_cc//cc/private/rules_impl:native_bzl"],
110125
visibility = ["@rules_cc//cc:__subpackages__"],
111126
)

cc/private/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ bzl_library(
6565
":objc_info_bzl",
6666
"//cc/private/compile:compile_bzl",
6767
"//cc/private/link:link_bzl",
68+
"//cc/private/rules_impl:cc_toolchain_info_bzl",
6869
"//cc/private/rules_impl:native_bzl",
6970
"//cc/private/toolchain_config:toolchain_config_bzl",
7071
],
@@ -98,7 +99,7 @@ bzl_library(
9899
name = "cc_launcher_info_bzl",
99100
srcs = ["cc_launcher_info.bzl"],
100101
visibility = ["//cc:__subpackages__"],
101-
deps = ["//cc/common"],
102+
deps = ["//cc/common:cc_helper_internal_bzl"],
102103
)
103104

104105
bzl_library(

cc/private/compile/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bzl_library(
2020
visibility = ["//visibility:public"],
2121
deps = [
2222
"//cc:action_names_bzl",
23-
"//cc/common",
23+
"//cc/common:semantics_bzl",
2424
"//cc/private:cc_internal_bzl",
2525
"//cc/private/rules_impl:native_bzl",
2626
"@bazel_skylib//lib:paths",

cc/private/link/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bzl_library(
2020
visibility = ["//visibility:public"],
2121
deps = [
2222
"//cc:action_names_bzl",
23-
"//cc/common",
23+
"//cc/common:semantics_bzl",
2424
"//cc/private:cc_internal_bzl",
2525
"//cc/private/compile:compile_bzl",
2626
"//cc/private/rules_impl:native_bzl",

cc/private/rules_impl/BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ bzl_library(
5656
"//cc:action_names_bzl",
5757
"//cc:find_cc_toolchain_bzl",
5858
"//cc/common",
59+
"//cc/common:cc_debug_helper_bzl",
5960
"@bazel_skylib//lib:paths",
6061
"@com_google_protobuf//bazel/common:proto_info_bzl",
6162
],
@@ -111,3 +112,12 @@ bzl_library(
111112
"@cc_compatibility_proxy//:__pkg__",
112113
],
113114
)
115+
116+
bzl_library(
117+
name = "cc_toolchain_info_bzl",
118+
srcs = ["cc_toolchain_info.bzl"],
119+
visibility = [
120+
"//cc:__subpackages__",
121+
"@cc_compatibility_proxy//:__pkg__",
122+
],
123+
)

cc/private/toolchain_config/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ bzl_library(
2121
deps = [
2222
"//cc:action_names_bzl",
2323
"//cc:cc_toolchain_config_lib_bzl",
24-
"//cc/common",
24+
"//cc/common:semantics_bzl",
2525
"//cc/private:cc_internal_bzl",
2626
"//cc/private/rules_impl:native_bzl",
2727
"@bazel_skylib//lib:paths",

cc/starlark_doc_extract_helper.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Indirection to avoid breaking on Bazel 6"""
22

3-
visibility("private")
3+
visibility("//cc/...")
44

55
def starlark_doc_extract_helper(**kwargs):
66
"""Creates a starlark_doc_extract target if the native rule is available

0 commit comments

Comments
 (0)