Refactor action sets for consistency and simplicity

BEGIN_PUBLIC
Refactor action sets for consistency and simplicity

* Remove the "CC" prefix on some of the actions, as we're already within the scope of rules_cc.
* Remove the "all" prefix, since the plural "actions" should already imply this.
* Ensure all action types sets end with "_actions"
* Refactor some action type sets to be constructed from other (eg. link actions = link executables + link dynamic libraries).
* Remove the redundant "all_compile_actions", since it was equivalent to "all_cc_compile_actions"
END_PUBLIC

PiperOrigin-RevId: 617985242
Change-Id: I9a3621a9d613ff604efdc5c86ba52e5c77f06731
This commit is contained in:
Googler 2024-03-21 15:44:09 -07:00 committed by Copybara-Service
parent 17143d150d
commit 7c0a3bbee1
4 changed files with 79 additions and 93 deletions

View File

@ -63,7 +63,7 @@ cc_action_type_set = rule(
Example:
cc_action_type_set(
name = "cc_link_executable_actions",
name = "link_executable_actions",
actions = [
":cpp_link_executable",
":lto_index_for_executable",

View File

@ -139,12 +139,12 @@ cc_action_type(
)
cc_action_type_set(
name = "all_ar_actions",
name = "ar_actions",
actions = [":cpp_link_static_library"],
)
cc_action_type_set(
name = "all_assembly_actions",
name = "assembly_actions",
actions = [
":preprocess_assemble",
":assemble",
@ -152,7 +152,7 @@ cc_action_type_set(
)
cc_action_type_set(
name = "all_cpp_compile_actions",
name = "cpp_compile_actions",
actions = [
":linkstamp_compile",
":cpp_compile",
@ -165,37 +165,24 @@ cc_action_type_set(
)
cc_action_type_set(
name = "all_cc_compile_actions",
name = "compile_actions",
actions = [
":all_cpp_compile_actions",
":cpp_compile_actions",
":c_compile",
":preprocess_assemble",
":assemble",
":assembly_actions",
],
)
cc_action_type_set(
name = "all_compile_actions",
name = "link_actions",
actions = [
":all_cc_compile_actions",
":all_cpp_compile_actions",
":link_executable_actions",
":dynamic_library_link_actions",
],
)
cc_action_type_set(
name = "all_cc_link_actions",
actions = [
":cpp_link_executable",
":cpp_link_dynamic_library",
":cpp_link_nodeps_dynamic_library",
":lto_index_for_executable",
":lto_index_for_dynamic_library",
":lto_index_for_nodeps_dynamic_library",
],
)
cc_action_type_set(
name = "cc_link_executable_actions",
name = "link_executable_actions",
actions = [
":cpp_link_executable",
":lto_index_for_executable",
@ -206,9 +193,8 @@ cc_action_type_set(
name = "dynamic_library_link_actions",
actions = [
":cpp_link_dynamic_library",
":cpp_link_nodeps_dynamic_library",
":lto_index_for_dynamic_library",
":lto_index_for_nodeps_dynamic_library",
":nodeps_dynamic_library_link_actions",
],
)

View File

@ -27,10 +27,10 @@ visibility("public")
# work out what actions correspond to what file groups.
_LEGACY_FILE_GROUPS = {
"ar_files": [
"@rules_cc//cc/toolchains/actions:all_ar_actions", # copybara-use-repo-external-label
"@rules_cc//cc/toolchains/actions:ar_actions", # copybara-use-repo-external-label
],
"as_files": [
"@rules_cc//cc/toolchains/actions:all_assembly_actions", # copybara-use-repo-external-label
"@rules_cc//cc/toolchains/actions:assembly_actions", # copybara-use-repo-external-label
],
"compiler_files": [
"@rules_cc//cc/toolchains/actions:cc_flags_make_variable", # copybara-use-repo-external-label

View File

@ -5,98 +5,98 @@ package(default_visibility = ["//visibility:public"])
cc_variable(
name = "cs_fdo_instrument_path",
actions = [
"//cc/toolchains/actions:all_cc_link_actions",
"//cc/toolchains/actions:all_compile_actions",
"//cc/toolchains/actions:link_actions",
"//cc/toolchains/actions:compile_actions",
],
type = types.directory,
)
cc_variable(
name = "def_file_path",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.file),
)
cc_variable(
name = "dependency_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "dependent_module_map_files",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.list(types.file)),
)
cc_variable(
name = "external_include_paths",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.list(types.directory)),
)
cc_variable(
name = "fdo_instrument_path",
actions = [
"//cc/toolchains/actions:all_cc_link_actions",
"//cc/toolchains/actions:all_compile_actions",
"//cc/toolchains/actions:link_actions",
"//cc/toolchains/actions:compile_actions",
],
type = types.directory,
)
cc_variable(
name = "fdo_prefetch_hints_path",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "fdo_profile_path",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "force_pic",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
# Provided when --force-pic is passed
type = types.option(types.void),
)
cc_variable(
name = "framework_include_paths",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.directory),
)
cc_variable(
name = "gcov_gcno_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "generate_interface_library",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
# "yes" or "no"
type = types.option(types.string),
)
cc_variable(
name = "include",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.file),
)
cc_variable(
name = "include_paths",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.directory),
)
cc_variable(
name = "includes",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.list(types.file)),
)
@ -108,55 +108,55 @@ cc_variable(
cc_variable(
name = "interface_library_builder_path",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
# Should be a file, but contains the string "ignored" when there's no value.
type = types.option(types.string),
)
cc_variable(
name = "interface_library_input_path",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
# Should be a file, but contains the string "ignored" when there's no value.
type = types.option(types.string),
)
cc_variable(
name = "interface_library_output_path",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
# Should be a file, but contains the string "ignored" when there's no value.
type = types.option(types.string),
)
cc_variable(
name = "is_cc_test",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.bool),
)
cc_variable(
name = "is_using_fission",
actions = [
"//cc/toolchains/actions:all_cc_link_actions",
"//cc/toolchains/actions:all_compile_actions",
"//cc/toolchains/actions:link_actions",
"//cc/toolchains/actions:compile_actions",
],
type = types.option(types.void),
)
cc_variable(
name = "legacy_compile_flags",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.string),
)
cc_variable(
name = "legacy_link_flags",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.list(types.string),
)
cc_variable(
name = "libraries_to_link",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.list(types.struct(
shared_libraries = types.list(types.struct(
name = types.string,
@ -170,164 +170,164 @@ cc_variable(
cc_variable(
name = "libraries_to_link.shared_libraries",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
# See :libraries_to_link.
type = types.unknown,
)
cc_variable(
name = "libraries_to_link.shared_libraries.is_whole_archive",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.string,
)
cc_variable(
name = "libraries_to_link.shared_libraries.name",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.string,
)
cc_variable(
name = "libraries_to_link.shared_libraries.object_files",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.list(types.file),
)
cc_variable(
name = "libraries_to_link.shared_libraries.path",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.file,
)
cc_variable(
name = "libraries_to_link.shared_libraries.type",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.string,
)
cc_variable(
name = "library_search_directories",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.list(types.directory),
)
cc_variable(
name = "linker_param_file",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.file,
)
cc_variable(
name = "linkstamp_paths",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.list(types.directory),
)
cc_variable(
name = "lto_indexing_bitcode_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.file),
)
cc_variable(
name = "module_files",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.list(types.file)),
)
cc_variable(
name = "module_map_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.file),
)
cc_variable(
name = "module_name",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.string),
)
cc_variable(
name = "output_assembly_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "output_execpath",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.directory),
)
cc_variable(
name = "output_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "output_preprocess_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "per_object_debug_info_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "pic",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.void),
)
cc_variable(
name = "preprocessor_defines",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.string),
)
cc_variable(
name = "propellor_optimize_ld_path",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.file),
)
cc_variable(
name = "quote_include_paths",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.directory),
)
cc_variable(
name = "runtime_library_search_directories",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.list(types.directory)),
)
cc_variable(
name = "runtime_solib_name",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.string),
)
cc_variable(
name = "serialized_diagnostics_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.file),
)
cc_variable(
name = "source_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.file,
)
cc_variable(
name = "strip_debug_symbols",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.void),
)
@ -344,73 +344,73 @@ cc_variable(
cc_variable(
name = "system_include_paths",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.directory),
)
cc_variable(
name = "thinlto_index",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.string),
)
cc_variable(
name = "thinlto_indexing_param_file",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.string),
)
cc_variable(
name = "thinlto_input_bitcode_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.file),
)
cc_variable(
name = "thinlto_merged_object_file",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.file),
)
cc_variable(
name = "thinlto_object_suffix_replace",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.string),
)
cc_variable(
name = "thinlto_output_object_file",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.option(types.file),
)
cc_variable(
name = "thinlto_param_file",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.file),
)
cc_variable(
name = "thinlto_prefix_replace",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.option(types.string),
)
cc_variable(
name = "unfiltered_compile_flags",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.string),
)
cc_variable(
name = "user_compile_flags",
actions = ["//cc/toolchains/actions:all_compile_actions"],
actions = ["//cc/toolchains/actions:compile_actions"],
type = types.list(types.string),
)
cc_variable(
name = "user_link_flags",
actions = ["//cc/toolchains/actions:all_cc_link_actions"],
actions = ["//cc/toolchains/actions:link_actions"],
type = types.list(types.string),
)