diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-02 12:00:44 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-02 14:09:02 +0200 |
commit | b2f795e0e05743a234587f3a1c32c9c1d4ec524f (patch) | |
tree | c5eecfc0d37fd9e581cc5dccb3c93a8482cb0e72 /src/buildtool/build_engine/target_map/target_map.cpp | |
parent | 217da1d00c8fd8351d79587f7394e1ca8f498cff (diff) | |
download | justbuild-b2f795e0e05743a234587f3a1c32c9c1d4ec524f.tar.gz |
Actions with non-trivial cwd: add empty input tree, if required
While our local action execution implicitly creates the specified
cwd with the first output file or directory, this behaviour is
not mandated by the remote-execution protocol. There, an action
definition has to ensure that cwd is a directory implied by the
input files. Achieve this, by adding an empty input directory
at cwd if this can be done without creating tree conflicts.
Diffstat (limited to 'src/buildtool/build_engine/target_map/target_map.cpp')
-rw-r--r-- | src/buildtool/build_engine/target_map/target_map.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp index 14d897b9..c7002270 100644 --- a/src/buildtool/build_engine/target_map/target_map.cpp +++ b/src/buildtool/build_engine/target_map/target_map.cpp @@ -513,7 +513,8 @@ void withDependencies( return eval(expr->Get("default", empty_list), env); }}, {"ACTION", - [&actions, &rule](auto&& eval, auto const& expr, auto const& env) { + [&actions, &rule, &trees]( + auto&& eval, auto const& expr, auto const& env) { auto const& empty_map_exp = Expression::kEmptyMapExpr; auto inputs_exp = eval(expr->Get("inputs", empty_map_exp), env); if (not inputs_exp->IsMap()) { @@ -605,6 +606,8 @@ void withDependencies( "cwd has to be a non-upwards relative path, but found {}", cwd_exp->ToString())}; } + auto final_inputs = BuildMaps::Target::Utils::add_dir_for( + cwd_exp->String(), inputs_exp, &trees); auto env_exp = eval(expr->Get("env", empty_map_exp), env); if (not env_exp->IsMap()) { throw Evaluator::EvaluationError{ @@ -716,7 +719,7 @@ void withDependencies( timeout_scale_exp->IsNumber() ? timeout_scale_exp->Number() : 1.0, execution_properties, - inputs_exp); + final_inputs); auto action_id = action->Id(); actions.emplace_back(std::move(action)); for (auto const& out : outputs) { |