diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-06-13 10:14:33 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-06-15 17:21:26 +0200 |
commit | 8d77b24503fcddce8f79f138cf07be5ad7eb8473 (patch) | |
tree | c39741cfafe3dce1d9a32dd9fd703621d384aee5 /src/buildtool/common/action.hpp | |
parent | fe336454e17bd228524c5575a3b5a641b3b10dc7 (diff) | |
download | justbuild-8d77b24503fcddce8f79f138cf07be5ad7eb8473.tar.gz |
action data structure: support (additional) execution properties
Diffstat (limited to 'src/buildtool/common/action.hpp')
-rw-r--r-- | src/buildtool/common/action.hpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/buildtool/common/action.hpp b/src/buildtool/common/action.hpp index 13760422..e9d4581d 100644 --- a/src/buildtool/common/action.hpp +++ b/src/buildtool/common/action.hpp @@ -32,13 +32,15 @@ class Action { std::map<std::string, std::string> env_vars, std::optional<std::string> may_fail, bool no_cache, - double timeout_scale) + double timeout_scale, + std::map<std::string, std::string> execution_properties) : id_{std::move(action_id)}, command_{std::move(command)}, env_{std::move(env_vars)}, may_fail_{std::move(may_fail)}, no_cache_{no_cache}, - timeout_scale_{timeout_scale} {} + timeout_scale_{timeout_scale}, + execution_properties_{std::move(std::move(execution_properties))} {} Action(std::string action_id, std::vector<std::string> command, @@ -48,7 +50,8 @@ class Action { std::move(env_vars), std::nullopt, false, - 1.0) {} + 1.0, + std::map<std::string, std::string>{}) {} [[nodiscard]] auto Id() const noexcept -> ActionIdentifier { return id_; } @@ -77,6 +80,16 @@ class Action { [[nodiscard]] auto NoCache() const -> bool { return no_cache_; } [[nodiscard]] auto TimeoutScale() const -> double { return timeout_scale_; } + [[nodiscard]] auto ExecutionProperties() const& noexcept + -> std::map<std::string, std::string> { + return execution_properties_; + } + + [[nodiscard]] auto ExecutionProperties() && noexcept + -> std::map<std::string, std::string> { + return std::move(execution_properties_); + } + [[nodiscard]] static auto CreateTreeAction(ActionIdentifier const& id) -> Action { return Action{id}; @@ -90,6 +103,7 @@ class Action { std::optional<std::string> may_fail_{}; bool no_cache_{}; double timeout_scale_{}; + std::map<std::string, std::string> execution_properties_{}; explicit Action(ActionIdentifier id) : id_{std::move(id)}, is_tree_{true} {} }; |