• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14load("//cc:action_names.bzl", "ACTION_NAMES")
15load("//cc/toolchains:actions.bzl", "cc_action_type", "cc_action_type_set")
16
17package(default_visibility = ["//visibility:public"])
18
19# Keep in sync with //cc:action_names.bzl.
20
21cc_action_type(
22    name = "c_compile",
23    action_name = ACTION_NAMES.c_compile,
24)
25
26cc_action_type(
27    name = "cpp_compile",
28    action_name = ACTION_NAMES.cpp_compile,
29)
30
31cc_action_type(
32    name = "linkstamp_compile",
33    action_name = ACTION_NAMES.linkstamp_compile,
34)
35
36cc_action_type(
37    name = "cc_flags_make_variable",
38    action_name = ACTION_NAMES.cc_flags_make_variable,
39)
40
41cc_action_type(
42    name = "cpp_module_codegen",
43    action_name = ACTION_NAMES.cpp_module_codegen,
44)
45
46cc_action_type(
47    name = "cpp_header_analysis",
48    action_name = "c++-header-analysis",
49)
50
51cc_action_type(
52    name = "cpp_header_parsing",
53    action_name = ACTION_NAMES.cpp_header_parsing,
54)
55
56cc_action_type(
57    name = "cpp_module_deps_scanning",
58    action_name = ACTION_NAMES.cpp_module_deps_scanning,
59)
60
61cc_action_type(
62    name = "cpp20_module_compile",
63    action_name = ACTION_NAMES.cpp20_module_compile,
64)
65
66cc_action_type(
67    name = "cpp20_module_codegen",
68    action_name = ACTION_NAMES.cpp20_module_codegen,
69)
70
71cc_action_type(
72    name = "cpp_module_compile",
73    action_name = ACTION_NAMES.cpp_module_compile,
74)
75
76cc_action_type(
77    name = "assemble",
78    action_name = ACTION_NAMES.assemble,
79)
80
81cc_action_type(
82    name = "preprocess_assemble",
83    action_name = ACTION_NAMES.preprocess_assemble,
84)
85
86cc_action_type(
87    name = "llvm_cov",
88    action_name = ACTION_NAMES.llvm_cov,
89)
90
91cc_action_type(
92    name = "lto_indexing",
93    action_name = ACTION_NAMES.lto_indexing,
94)
95
96cc_action_type(
97    name = "lto_backend",
98    action_name = ACTION_NAMES.lto_backend,
99)
100
101cc_action_type(
102    name = "lto_index_for_executable",
103    action_name = ACTION_NAMES.lto_index_for_executable,
104)
105
106cc_action_type(
107    name = "lto_index_for_dynamic_library",
108    action_name = ACTION_NAMES.lto_index_for_dynamic_library,
109)
110
111cc_action_type(
112    name = "lto_index_for_nodeps_dynamic_library",
113    action_name = ACTION_NAMES.lto_index_for_nodeps_dynamic_library,
114)
115
116cc_action_type(
117    name = "cpp_link_executable",
118    action_name = ACTION_NAMES.cpp_link_executable,
119)
120
121cc_action_type(
122    name = "cpp_link_dynamic_library",
123    action_name = ACTION_NAMES.cpp_link_dynamic_library,
124)
125
126cc_action_type(
127    name = "cpp_link_nodeps_dynamic_library",
128    action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
129)
130
131cc_action_type(
132    name = "cpp_link_static_library",
133    action_name = ACTION_NAMES.cpp_link_static_library,
134)
135
136cc_action_type(
137    name = "strip",
138    action_name = ACTION_NAMES.strip,
139)
140
141cc_action_type(
142    name = "objcopy_embed_data",
143    action_name = ACTION_NAMES.objcopy_embed_data,
144)
145
146cc_action_type(
147    name = "validate_static_library",
148    action_name = ACTION_NAMES.validate_static_library,
149)
150
151# ld_embed_data is only available within google.
152cc_action_type(
153    # # copybara-comment-this-out-please
154    name = "ld_embed_data_action",  # # copybara-comment-this-out-please
155    action_name = "ld_embed_data",  # # copybara-comment-this-out-please
156)  # # copybara-comment-this-out-please
157
158# To make things simple, both internal and external rules will refer to
159# ld_embed_data, but externally it will evaluate to the empty set.
160cc_action_type_set(
161    name = "ld_embed_data",
162    actions = [
163        ":ld_embed_data_action",  # # copybara-comment-this-out-please
164    ],
165    allow_empty = True,
166    visibility = ["//cc/toolchains:__subpackages__"],
167)
168
169cc_action_type(
170    name = "objc_compile",
171    action_name = ACTION_NAMES.objc_compile,
172)
173
174cc_action_type(
175    name = "objc_executable",
176    action_name = ACTION_NAMES.objc_executable,
177)
178
179cc_action_type(
180    name = "objc_fully_link",
181    action_name = ACTION_NAMES.objc_fully_link,
182)
183
184cc_action_type(
185    name = "objcpp_compile",
186    action_name = ACTION_NAMES.objcpp_compile,
187)
188
189cc_action_type(
190    name = "objcpp_executable",
191    action_name = "objc++-executable",
192)
193
194cc_action_type(
195    name = "clif_match",
196    action_name = ACTION_NAMES.clif_match,
197)
198
199cc_action_type_set(
200    name = "ar_actions",
201    actions = [":cpp_link_static_library"],
202)
203
204cc_action_type_set(
205    name = "assembly_actions",
206    actions = [
207        ":preprocess_assemble",
208        ":assemble",
209    ],
210)
211
212cc_action_type_set(
213    name = "c_compile_actions",
214    actions = [
215        ":c_compile",
216    ],
217)
218
219cc_action_type_set(
220    name = "cpp_compile_actions",
221    actions = [
222        ":linkstamp_compile",
223        ":cpp_compile",
224        ":cpp_header_parsing",
225        ":cpp_module_compile",
226        ":cpp_module_codegen",
227        ":lto_backend",
228        ":clif_match",
229    ],
230)
231
232cc_action_type_set(
233    name = "compile_actions",
234    actions = [
235        ":cpp_compile_actions",
236        ":c_compile_actions",
237        ":assembly_actions",
238        ":objc_compile",
239        ":objcpp_compile",
240    ],
241)
242
243cc_action_type_set(
244    name = "link_actions",
245    actions = [
246        ":link_executable_actions",
247        ":dynamic_library_link_actions",
248    ],
249)
250
251cc_action_type_set(
252    name = "link_executable_actions",
253    actions = [
254        ":cpp_link_executable",
255        ":lto_index_for_executable",
256    ],
257)
258
259cc_action_type_set(
260    name = "dynamic_library_link_actions",
261    actions = [
262        ":cpp_link_dynamic_library",
263        ":lto_index_for_dynamic_library",
264        ":nodeps_dynamic_library_link_actions",
265    ],
266)
267
268cc_action_type_set(
269    name = "nodeps_dynamic_library_link_actions",
270    actions = [
271        ":cpp_link_nodeps_dynamic_library",
272        ":lto_index_for_nodeps_dynamic_library",
273    ],
274)
275
276cc_action_type_set(
277    name = "transitive_link_actions",
278    actions = [
279        ":cpp_link_executable",
280        ":cpp_link_dynamic_library",
281        ":lto_index_for_executable",
282        ":lto_index_for_dynamic_library",
283    ],
284)
285
286cc_action_type_set(
287    name = "all_actions",
288    actions = [
289        ":c_compile",
290        ":cpp_compile",
291        ":linkstamp_compile",
292        ":cc_flags_make_variable",
293        ":cpp_module_codegen",
294        ":cpp_header_analysis",
295        ":cpp_header_parsing",
296        ":cpp_module_deps_scanning",
297        ":cpp20_module_compile",
298        ":cpp20_module_codegen",
299        ":cpp_module_compile",
300        ":assemble",
301        ":preprocess_assemble",
302        ":llvm_cov",
303        ":lto_indexing",
304        ":lto_backend",
305        ":lto_index_for_executable",
306        ":lto_index_for_dynamic_library",
307        ":lto_index_for_nodeps_dynamic_library",
308        ":cpp_link_executable",
309        ":cpp_link_dynamic_library",
310        ":cpp_link_nodeps_dynamic_library",
311        ":cpp_link_static_library",
312        ":strip",
313        ":objcopy_embed_data",
314        ":ld_embed_data",
315        ":objc_compile",
316        ":objc_executable",
317        ":objc_fully_link",
318        ":objcpp_compile",
319        ":objcpp_executable",
320        ":clif_match",
321        ":validate_static_library",
322    ],
323)
324