diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-06-13 11:55:41 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-06-15 17:21:26 +0200 |
commit | 30e95687b5daae3173655a7fc198b37b5a4b8820 (patch) | |
tree | 29611b8edab8211947cbe586cd6771f7c57a9ad9 /src | |
parent | 8d77b24503fcddce8f79f138cf07be5ad7eb8473 (diff) | |
download | justbuild-30e95687b5daae3173655a7fc198b37b5a4b8820.tar.gz |
ACTION constructor: accept "execution properties"
Allow rules to set (additional) execution properties for individual
action. In this way the need for a special image (e.g., with
additional, maybe test-only, tools) or execution platform (e.g.,
when cross-compiling but having to execute the tests on the native
platform) can be expressed.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/build_engine/target_map/target_map.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp index 7194ba12..d2e73f07 100644 --- a/src/buildtool/build_engine/target_map/target_map.cpp +++ b/src/buildtool/build_engine/target_map/target_map.cpp @@ -563,6 +563,27 @@ void withDependencies( "for default), but found {}", timeout_scale_exp->ToString())}; } + auto execution_properties = eval( + expr->Get("execution properties", Expression::kEmptyMapExpr), + env); + if (execution_properties->IsNone()) { + execution_properties = Expression::kEmptyMap; + } + if (not(execution_properties->IsMap())) { + throw Evaluator::EvaluationError{ + fmt::format("execution properties has to be a map of " + "strings (or null for empty), but found {}", + execution_properties->ToString())}; + } + for (auto const& [prop_name, prop_value] : + execution_properties->Map()) { + if (not prop_value->IsString()) { + throw Evaluator::EvaluationError{fmt::format( + "execution properties has to be a map of " + "strings (or null for empty), but found {}", + execution_properties->ToString())}; + } + } auto action = BuildMaps::Target::Utils::createAction( outputs, output_dirs, @@ -572,7 +593,7 @@ void withDependencies( no_cache, timeout_scale_exp->IsNumber() ? timeout_scale_exp->Number() : 1.0, - Expression::kEmptyMap, + execution_properties, inputs_exp); auto action_id = action->Id(); actions.emplace_back(std::move(action)); |