diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-02-28 13:04:43 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-02-28 13:39:13 +0100 |
commit | 541edbb79bf69b98ebeb7bf7b2305eaa0252fde2 (patch) | |
tree | 7a64ad7c0cbae0cc131d5c5b9e0cd0b9aaeee28f /src/buildtool/common/cli.hpp | |
parent | ebdd2a3614061b4b78ee771774470be73f346537 (diff) | |
download | justbuild-541edbb79bf69b98ebeb7bf7b2305eaa0252fde2.tar.gz |
CLI: Add option to set action timeout
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r-- | src/buildtool/common/cli.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 97efb9d3..7e93b9ec 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -1,6 +1,7 @@ #ifndef INCLUDED_SRC_BUILDTOOL_COMMON_CLI_HPP #define INCLUDED_SRC_BUILDTOOL_COMMON_CLI_HPP +#include <chrono> #include <cstdlib> #include <filesystem> #include <string> @@ -14,6 +15,7 @@ #include "src/buildtool/logging/log_level.hpp" constexpr auto kDefaultLogLevel = LogLevel::Info; +constexpr auto kDefaultTimeout = std::chrono::milliseconds{300000}; /// \brief Arguments common to all commands. struct CommonArguments { @@ -59,6 +61,7 @@ struct EndpointArguments { struct BuildArguments { std::optional<std::vector<std::string>> local_launcher{std::nullopt}; std::map<std::string, std::string> platform_properties; + std::chrono::milliseconds timeout{kDefaultTimeout}; std::size_t build_jobs{}; std::optional<std::string> dump_artifacts{std::nullopt}; std::optional<std::string> print_to_stdout{std::nullopt}; @@ -269,6 +272,14 @@ static inline auto SetupBuildArguments( ->allow_extra_args(false) ->expected(1, 1); + app->add_option_function<unsigned int>( + "--action_timeout", + [clargs](auto const& seconds) { + clargs->timeout = seconds * std::chrono::seconds{1}; + }, + "Action timeout in seconds. (Default: 300).") + ->type_name("NUM"); + app->add_option( "-J,--build_jobs", clargs->build_jobs, |