diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-31 10:04:28 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-08-01 17:58:11 +0200 |
commit | ed71beee3e3a2bbfcba24281ad9e28a0f6df4054 (patch) | |
tree | 60811333fc6a42f5aa315cc6fbadb3c671e28199 /src/buildtool/common/action_description.hpp | |
parent | 62fed0cf026e676297b7560d8ffaef77d3017ce4 (diff) | |
download | justbuild-ed71beee3e3a2bbfcba24281ad9e28a0f6df4054.tar.gz |
class Action: include field cwd
... for the working directory inside the action directory.
Diffstat (limited to 'src/buildtool/common/action_description.hpp')
-rw-r--r-- | src/buildtool/common/action_description.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/buildtool/common/action_description.hpp b/src/buildtool/common/action_description.hpp index 47a92eb8..2ae7ad8a 100644 --- a/src/buildtool/common/action_description.hpp +++ b/src/buildtool/common/action_description.hpp @@ -83,6 +83,19 @@ class ActionDescription { output_dirs = std::vector<std::string>{}; } + std::string cwd{}; + auto cwd_it = desc.find("cwd"); + if (cwd_it != desc.end()) { + if (cwd_it->is_string()) { + cwd = *cwd_it; + } + else { + Logger::Log(LogLevel::Error, + "cwd, if given, has to be a string"); + return std::nullopt; + } + } + auto optional_key_value_reader = [](nlohmann::json const& action_desc, std::string const& key) -> nlohmann::json { @@ -160,6 +173,7 @@ class ActionDescription { std::move(*output_dirs), Action{id, std::move(*command), + cwd, env, may_fail, no_cache, @@ -206,6 +220,9 @@ class ActionDescription { if (action_.TimeoutScale() != 1.0) { json["timeout scaling"] = action_.TimeoutScale(); } + if (not action_.Cwd().empty()) { + json["cwd"] = action_.Cwd(); + } if (not action_.ExecutionProperties().empty()) { json["execution properties"] = action_.ExecutionProperties(); } |