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_compile", 58 action_name = ACTION_NAMES.cpp_module_compile, 59) 60 61cc_action_type( 62 name = "assemble", 63 action_name = ACTION_NAMES.assemble, 64) 65 66cc_action_type( 67 name = "preprocess_assemble", 68 action_name = ACTION_NAMES.preprocess_assemble, 69) 70 71cc_action_type( 72 name = "lto_indexing", 73 action_name = ACTION_NAMES.lto_indexing, 74) 75 76cc_action_type( 77 name = "lto_backend", 78 action_name = ACTION_NAMES.lto_backend, 79) 80 81cc_action_type( 82 name = "lto_index_for_executable", 83 action_name = ACTION_NAMES.lto_index_for_executable, 84) 85 86cc_action_type( 87 name = "lto_index_for_dynamic_library", 88 action_name = ACTION_NAMES.lto_index_for_dynamic_library, 89) 90 91cc_action_type( 92 name = "lto_index_for_nodeps_dynamic_library", 93 action_name = ACTION_NAMES.lto_index_for_nodeps_dynamic_library, 94) 95 96cc_action_type( 97 name = "cpp_link_executable", 98 action_name = ACTION_NAMES.cpp_link_executable, 99) 100 101cc_action_type( 102 name = "cpp_link_dynamic_library", 103 action_name = ACTION_NAMES.cpp_link_dynamic_library, 104) 105 106cc_action_type( 107 name = "cpp_link_nodeps_dynamic_library", 108 action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library, 109) 110 111cc_action_type( 112 name = "cpp_link_static_library", 113 action_name = ACTION_NAMES.cpp_link_static_library, 114) 115 116cc_action_type( 117 name = "strip", 118 action_name = ACTION_NAMES.strip, 119) 120 121cc_action_type( 122 name = "objcopy_embed_data", 123 action_name = "objcopy_embed_data", 124) 125 126# ld_embed_data is only available within google. 127cc_action_type( 128 # # copybara-comment-this-out-please 129 name = "ld_embed_data_action", # # copybara-comment-this-out-please 130 action_name = "ld_embed_data", # # copybara-comment-this-out-please 131) # # copybara-comment-this-out-please 132 133# To make things simple, both internal and external rules will refer to 134# ld_embed_data, but externally it will evaluate to the empty set. 135cc_action_type_set( 136 name = "ld_embed_data", 137 actions = [ 138 ":ld_embed_data_action", # # copybara-comment-this-out-please 139 ], 140 allow_empty = True, 141 visibility = ["//cc/toolchains:__subpackages__"], 142) 143 144cc_action_type( 145 name = "objc_compile", 146 action_name = ACTION_NAMES.objc_compile, 147) 148 149cc_action_type( 150 name = "objc_executable", 151 action_name = ACTION_NAMES.objc_executable, 152) 153 154cc_action_type( 155 name = "objc_fully_link", 156 action_name = ACTION_NAMES.objc_fully_link, 157) 158 159cc_action_type( 160 name = "objcpp_compile", 161 action_name = ACTION_NAMES.objcpp_compile, 162) 163 164cc_action_type( 165 name = "objcpp_executable", 166 action_name = "objc++-executable", 167) 168 169cc_action_type( 170 name = "clif_match", 171 action_name = ACTION_NAMES.clif_match, 172) 173 174cc_action_type_set( 175 name = "ar_actions", 176 actions = [":cpp_link_static_library"], 177) 178 179cc_action_type_set( 180 name = "assembly_actions", 181 actions = [ 182 ":preprocess_assemble", 183 ":assemble", 184 ], 185) 186 187cc_action_type_set( 188 name = "cpp_compile_actions", 189 actions = [ 190 ":linkstamp_compile", 191 ":cpp_compile", 192 ":cpp_header_parsing", 193 ":cpp_module_compile", 194 ":cpp_module_codegen", 195 ":lto_backend", 196 ":clif_match", 197 ], 198) 199 200cc_action_type_set( 201 name = "compile_actions", 202 actions = [ 203 ":cpp_compile_actions", 204 ":c_compile", 205 ":assembly_actions", 206 ], 207) 208 209cc_action_type_set( 210 name = "link_actions", 211 actions = [ 212 ":link_executable_actions", 213 ":dynamic_library_link_actions", 214 ], 215) 216 217cc_action_type_set( 218 name = "link_executable_actions", 219 actions = [ 220 ":cpp_link_executable", 221 ":lto_index_for_executable", 222 ], 223) 224 225cc_action_type_set( 226 name = "dynamic_library_link_actions", 227 actions = [ 228 ":cpp_link_dynamic_library", 229 ":lto_index_for_dynamic_library", 230 ":nodeps_dynamic_library_link_actions", 231 ], 232) 233 234cc_action_type_set( 235 name = "nodeps_dynamic_library_link_actions", 236 actions = [ 237 ":cpp_link_nodeps_dynamic_library", 238 ":lto_index_for_nodeps_dynamic_library", 239 ], 240) 241 242cc_action_type_set( 243 name = "transitive_link_actions", 244 actions = [ 245 ":cpp_link_executable", 246 ":cpp_link_dynamic_library", 247 ":lto_index_for_executable", 248 ":lto_index_for_dynamic_library", 249 ], 250) 251 252cc_action_type_set( 253 name = "all_actions", 254 actions = [ 255 ":c_compile", 256 ":cpp_compile", 257 ":linkstamp_compile", 258 ":cc_flags_make_variable", 259 ":cpp_module_codegen", 260 ":cpp_header_analysis", 261 ":cpp_header_parsing", 262 ":cpp_module_compile", 263 ":assemble", 264 ":preprocess_assemble", 265 ":lto_indexing", 266 ":lto_backend", 267 ":lto_index_for_executable", 268 ":lto_index_for_dynamic_library", 269 ":lto_index_for_nodeps_dynamic_library", 270 ":cpp_link_executable", 271 ":cpp_link_dynamic_library", 272 ":cpp_link_nodeps_dynamic_library", 273 ":cpp_link_static_library", 274 ":strip", 275 ":objcopy_embed_data", 276 ":ld_embed_data", 277 ":objc_compile", 278 ":objc_executable", 279 ":objc_fully_link", 280 ":objcpp_compile", 281 ":objcpp_executable", 282 ":clif_match", 283 ], 284) 285