Skip to content

Commit c4dc970

Browse files
committed
pass in feature config
1 parent d5e4799 commit c4dc970

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

cc/common/cc_helper.bzl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -464,17 +464,11 @@ def _get_compilation_contexts_from_deps(deps):
464464
compilation_contexts.append(dep[CcInfo].compilation_context)
465465
return compilation_contexts
466466

467-
def _tool_path(cc_toolchain, tool, ctx = None, action_name = None):
467+
def _tool_path(cc_toolchain, tool, feature_configuration = None, action_name = None):
468468
tool = cc_toolchain._tool_paths.get(tool, None)
469469
if tool:
470470
return tool
471-
if ctx != None and action_name != None:
472-
feature_configuration = cc_common.configure_features(
473-
ctx = ctx,
474-
cc_toolchain = cc_toolchain,
475-
requested_features = ctx.features,
476-
unsupported_features = ctx.disabled_features,
477-
)
471+
if feature_configuration != None and action_name != None:
478472
if not cc_common.action_is_enabled(
479473
feature_configuration = feature_configuration,
480474
action_name = action_name,
@@ -1035,11 +1029,18 @@ def _get_coverage_environment(ctx, cc_config, cc_toolchain):
10351029
if not ctx.configuration.coverage_enabled:
10361030
return {}
10371031

1032+
feature_configuration = cc_common.configure_features(
1033+
ctx = ctx,
1034+
cc_toolchain = cc_toolchain,
1035+
requested_features = ctx.features,
1036+
unsupported_features = ctx.disabled_features,
1037+
)
1038+
10381039
# buildifier: disable=unsorted-dict-items
10391040
env = {
1040-
"COVERAGE_GCOV_PATH": _tool_path(cc_toolchain, "gcov", ctx, ACTION_NAMES.gcov),
1041-
"LLVM_COV": _tool_path(cc_toolchain, "llvm-cov", ctx, ACTION_NAMES.llvm_cov),
1042-
"LLVM_PROFDATA": _tool_path(cc_toolchain, "llvm-profdata", ctx, ACTION_NAMES.llvm_profdata),
1041+
"COVERAGE_GCOV_PATH": _tool_path(cc_toolchain, "gcov", feature_configuration, ACTION_NAMES.gcov),
1042+
"LLVM_COV": _tool_path(cc_toolchain, "llvm-cov", feature_configuration, ACTION_NAMES.llvm_cov),
1043+
"LLVM_PROFDATA": _tool_path(cc_toolchain, "llvm-profdata", feature_configuration, ACTION_NAMES.llvm_profdata),
10431044
"GENERATE_LLVM_LCOV": "1" if cc_config.generate_llvm_lcov() else "0",
10441045
}
10451046
for k in list(env.keys()):

0 commit comments

Comments
 (0)