diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-11-15 17:13:38 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-11-16 15:09:05 +0100 |
commit | c3b10ee7c9320ed6cf5daec6310b0296812ea86a (patch) | |
tree | 1ea7b015ea9cc2a30fb896f689b4ea5da0e41cc0 /src | |
parent | 7027ce395a7aa835dd261fce0a554265c9753006 (diff) | |
download | justbuild-c3b10ee7c9320ed6cf5daec6310b0296812ea86a.tar.gz |
Make "config" accept a computed target
... and thus allowing the "business logic" in the configuration
target (e.g., setting defaults and derived options) to be shared
by many targets.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/build_engine/target_map/built_in_rules.cpp | 11 |
1 files changed, 10 insertions, 1 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 a34dfb03..763385e2 100644 --- a/src/buildtool/build_engine/target_map/built_in_rules.cpp +++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp @@ -953,7 +953,16 @@ void ConfigureRule( } auto param_config = key.config.Prune(*param_vars); - auto configured_target_name = desc->ReadExpression("target"); + auto configured_target_name_exp = desc->ReadExpression("target"); + if (not configured_target_name_exp) { + return; + } + auto configured_target_name = configured_target_name_exp.Evaluate( + param_config, {}, [logger](std::string const& msg) { + (*logger)( + fmt::format("Evaluating 'target' failed with error:\n{}", msg), + true); + }); if (not configured_target_name) { return; } |