Skip to content

Commit

Permalink
Flip AEGs in cc rules (cc_library, cc_binary, cc_import)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 530279049
Change-Id: I59ff7393ac2d0a015ad06da0d2d2a02fe256d2af
  • Loading branch information
kotlaja authored and copybara-github committed May 8, 2023
1 parent 17685c0 commit 6ce7a54
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def _create_intermediate_dwp_packagers(ctx, dwp_output, cc_toolchain, dwp_files,
mnemonic = "CcGenerateIntermediateDwp",
tools = packager["tools"],
executable = packager["executable"],
toolchain = cc_helper.CPP_TOOLCHAIN_TYPE,
arguments = [packager["arguments"]],
inputs = packager["inputs"],
outputs = packager["outputs"],
Expand Down Expand Up @@ -141,6 +142,7 @@ def _create_debug_packager_actions(ctx, cc_toolchain, dwp_output, dwo_files):
mnemonic = "CcGenerateDwp",
tools = packager["tools"],
executable = packager["executable"],
toolchain = cc_helper.CPP_TOOLCHAIN_TYPE,
arguments = [packager["arguments"]],
inputs = packager["inputs"],
outputs = packager["outputs"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ cc_binary_attrs_with_aspects = {
"_cc_toolchain": attr.label(default = "@" + semantics.get_repo() + "//tools/cpp:current_cc_toolchain"),
"_cc_toolchain_type": attr.label(default = "@" + semantics.get_repo() + "//tools/cpp:toolchain_type"),
"_def_parser": semantics.get_def_parser(),
"_use_auto_exec_groups": attr.bool(default = True),
}

cc_binary_attrs_with_aspects.update(semantics.get_distribs_attr())
Expand Down
3 changes: 3 additions & 0 deletions src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def _create_strip_action(ctx, cc_toolchain, cpp_config, input, output, feature_c
outputs = [output],
use_default_shell_env = True,
executable = cc_common.get_tool_for_action(feature_configuration = feature_configuration, action_name = "strip"),
toolchain = cc_helper.CPP_TOOLCHAIN_TYPE,
execution_requirements = execution_info,
progress_message = "Stripping {} for {}".format(output.short_path, ctx.label),
mnemonic = "CcStrip",
Expand Down Expand Up @@ -359,6 +360,7 @@ def _generate_def_file(ctx, def_parser, object_files, dll_name):
ctx.actions.run(
mnemonic = "DefParser",
executable = def_parser,
toolchain = None,
arguments = [args, argv],
inputs = object_files,
outputs = [def_file],
Expand Down Expand Up @@ -1208,6 +1210,7 @@ def _copts_filter(ctx, additional_make_variable_substitutions):
return _expand(ctx, nocopts, additional_make_variable_substitutions)

cc_helper = struct(
CPP_TOOLCHAIN_TYPE = _CPP_TOOLCHAIN_TYPE,
merge_cc_debug_contexts = _merge_cc_debug_contexts,
is_code_coverage_enabled = _is_code_coverage_enabled,
get_dynamic_libraries_for_runtime = _get_dynamic_libraries_for_runtime,
Expand Down
2 changes: 2 additions & 0 deletions src/main/starlark/builtins_bzl/common/cc/cc_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def _create_archive_action(
# action is created by cc_library
ctx.actions.run(
executable = archiver_path,
toolchain = cc_helper.CPP_TOOLCHAIN_TYPE,
arguments = [args],
env = env,
inputs = depset(
Expand Down Expand Up @@ -206,6 +207,7 @@ cc_import = rule(
default = Label("@" + semantics.get_repo() + "//tools/cpp:grep-includes"),
),
"_cc_toolchain": attr.label(default = "@" + semantics.get_repo() + "//tools/cpp:current_cc_toolchain"),
"_use_auto_exec_groups": attr.bool(default = True),
},
provides = [CcInfo],
toolchains = cc_helper.use_cpp_toolchain(),
Expand Down
1 change: 1 addition & 0 deletions src/main/starlark/builtins_bzl/common/cc/cc_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ attrs = {
),
"_def_parser": semantics.get_def_parser(),
"_cc_toolchain": attr.label(default = "@" + semantics.get_repo() + "//tools/cpp:current_cc_toolchain"),
"_use_auto_exec_groups": attr.bool(default = True),
}
attrs.update(semantics.get_distribs_attr())
attrs.update(semantics.get_loose_mode_in_hdrs_check_allowed_attr())
Expand Down

0 comments on commit 6ce7a54

Please sign in to comment.