summaryrefslogtreecommitdiff
path: root/src/buildtool/common/action_description.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/common/action_description.hpp')
-rw-r--r--src/buildtool/common/action_description.hpp17
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();
}