From 3f4be00888db39abea7d6789b15269f79f084afc Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 15 Jun 2023 14:22:51 +0200 Subject: executor: honor action-specific execution properties --- src/buildtool/execution_engine/executor/executor.hpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/buildtool/execution_engine/executor/executor.hpp') diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index f239c381..d262eac5 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -41,6 +41,16 @@ static inline auto scale_time(std::chrono::milliseconds t, double f) -> std::chrono::milliseconds { return std::chrono::milliseconds(std::lround(t.count() * f)); } + +static inline auto merge_properties( + const std::map& base, + const std::map& overlay) { + std::map result = base; + for (auto const& [k, v] : overlay) { + result[k] = v; + } + return result; +} } // namespace detail /// \brief Implementations for executing actions and uploading artifacts. @@ -587,7 +597,8 @@ class Executor { logger, action, remote_api_, - properties_, + detail::merge_properties(properties_, + action->ExecutionProperties()), detail::scale_time(timeout_, action->TimeoutScale()), action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput); @@ -645,7 +656,8 @@ class Rebuilder { logger, action, remote_api_, - properties_, + detail::merge_properties(properties_, + action->ExecutionProperties()), detail::scale_time(timeout_, action->TimeoutScale()), CF::PretendCached); @@ -658,7 +670,8 @@ class Rebuilder { logger_cached, action, api_cached_, - properties_, + detail::merge_properties(properties_, + action->ExecutionProperties()), detail::scale_time(timeout_, action->TimeoutScale()), CF::FromCacheOnly); -- cgit v1.2.3