diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-02-19 16:02:49 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-03-10 16:28:59 +0100 |
commit | f26497d1ed48042c210603c921ba065988e5ad04 (patch) | |
tree | 97d7980496552457fda29e08fa95e920d53c00bd | |
parent | a0db78bd86a21fa072e28fa6dfd0fc53fd72a652 (diff) | |
download | justbuild-f26497d1ed48042c210603c921ba065988e5ad04.tar.gz |
Add rc-parameters for invocation logging
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 8 | ||||
-rw-r--r-- | src/other_tools/just_mr/rc.cpp | 28 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 96f7cba2..44acc1f5 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -89,6 +89,13 @@ struct MultiRepoGcArguments { bool drop_only{false}; }; +// Arguments for invocation logging; set only via rc files +struct InvocationLogArguments { + std::optional<std::filesystem::path> directory{std::nullopt}; + std::optional<std::string> project_id{std::nullopt}; + std::optional<std::string> metadata{std::nullopt}; +}; + struct MultiRepoJustSubCmdsArguments { std::optional<std::string> subcmd_name{std::nullopt}; std::vector<std::string> additional_just_args; @@ -132,6 +139,7 @@ struct CommandLineArguments { MultiRepoJustSubCmdsArguments just_cmd; MultiRepoRemoteAuthArguments auth; ForwardOnlyArguments launch_fwd; + InvocationLogArguments invocation_log; }; static inline void SetupMultiRepoCommonArguments( diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp index 0359253c..401510f9 100644 --- a/src/other_tools/just_mr/rc.cpp +++ b/src/other_tools/just_mr/rc.cpp @@ -584,6 +584,34 @@ namespace { } } } + // read invocation log argumnets + auto invocation_log = rc_config["invocation log"]; + if (invocation_log.IsNotNull()) { + if (not invocation_log->IsMap()) { + Logger::Log( + LogLevel::Error, + "Value of \"invocation log\" has to be a map, but found {}", + invocation_log->ToString()); + std::exit(kExitConfigError); + } + auto dir = + ReadLocation(invocation_log->Get("directory", Expression::none_t{}), + clargs->common.just_mr_paths->workspace_root); + if (dir) { + clargs->invocation_log.directory = dir->first; + // Parse the remaining entries, only if directory is specified + auto proj_id = + invocation_log->Get("project id", Expression::none_t{}); + if (proj_id->IsString()) { + clargs->invocation_log.project_id = proj_id->String(); + } + auto metadata = + invocation_log->Get("metadata", Expression::none_t{}); + if (metadata->IsString()) { + clargs->invocation_log.metadata = metadata->String(); + } + } + } // read config lookup order auto config_lookup_order = rc_config["config lookup order"]; if (config_lookup_order.IsNotNull()) { |