summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-11-16 11:38:23 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-11-16 15:09:05 +0100
commitfbc34ed2cb3e42a2d5df6db67a362b127df42f7d (patch)
tree5ea1e234f4db3e07bf9bec047bd27d7657c881f7 /src
parentc3b10ee7c9320ed6cf5daec6310b0296812ea86a (diff)
downloadjustbuild-fbc34ed2cb3e42a2d5df6db67a362b127df42f7d.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.cpp22
1 files changed, 13 insertions, 9 deletions
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<std::string> 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>(
- 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::string>{},
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);