From fbc34ed2cb3e42a2d5df6db67a362b127df42f7d Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 16 Nov 2022 11:38:23 +0100 Subject: Fix effective configuration computation in configure While the built-in "configure" rule is forwarding the result of the configured target, its own effective configuration is not that of the configured target. The effective configuration is defined to be that part of the incoming configuration that can potentially influence the result of that target; in particular, this includes variables read in defining the configuration transition. --- .../build_engine/target_map/built_in_rules.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/buildtool/build_engine/target_map/built_in_rules.cpp b/src/buildtool/build_engine/target_map/built_in_rules.cpp index 763385e2..f71cd0e8 100644 --- a/src/buildtool/build_engine/target_map/built_in_rules.cpp +++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp @@ -1016,7 +1016,7 @@ void ConfigureRule( auto target_config = key.config.Update(eval_config); auto target_to_configure = BuildMaps::Target::ConfiguredTarget{ - std::move(*configured_target), target_config}; + std::move(*configured_target), std::move(target_config)}; (*subcaller)( {std::move(target_to_configure)}, @@ -1024,9 +1024,9 @@ void ConfigureRule( logger, vars = std::move(*param_vars), result_map, + transition = Configuration{std::move(eval_config)}, tainted = std::move(tainted), - target_config = std::move(target_config), - target = key.target](auto const& values) { + key](auto const& values) { auto& configured_target = *values[0]; if (not std::includes(tainted.begin(), tainted.end(), @@ -1040,14 +1040,17 @@ void ConfigureRule( } std::unordered_set vars_set{}; + for (auto const& x : configured_target->Vars()) { + if (not transition.VariableFixed(x)) { + vars_set.insert(x); + } + } vars_set.insert(vars.begin(), vars.end()); - vars_set.insert(configured_target->Vars().begin(), - configured_target->Vars().end()); - auto effective_conf = target_config.Prune(vars_set); + auto effective_conf = key.config.Prune(vars_set); auto deps_info = TargetGraphInformation{ std::make_shared( - BuildMaps::Target::ConfiguredTarget{target, + BuildMaps::Target::ConfiguredTarget{key.target, effective_conf}), {configured_target->GraphInformation().Node()}, {}, @@ -1061,8 +1064,9 @@ void ConfigureRule( std::move(vars_set), std::set{}, std::move(deps_info)); - analysis_result = result_map->Add( - target, std::move(effective_conf), std::move(analysis_result)); + analysis_result = result_map->Add(key.target, + std::move(effective_conf), + std::move(analysis_result)); (*setter)(std::move(analysis_result)); }, logger); -- cgit v1.2.3