diff options
Diffstat (limited to 'src/other_tools')
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 2 | ||||
-rw-r--r-- | src/other_tools/just_mr/launch.cpp | 10 | ||||
-rw-r--r-- | src/other_tools/just_mr/rc.cpp | 44 | ||||
-rw-r--r-- | src/other_tools/just_mr/utils.hpp | 9 |
4 files changed, 65 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 3d7a8980..b4f6607d 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -80,6 +80,8 @@ struct MultiRepoJustSubCmdsArguments { std::optional<std::string> subcmd_name{std::nullopt}; std::vector<std::string> additional_just_args{}; std::unordered_map<std::string, std::vector<std::string>> just_args{}; + std::optional<std::filesystem::path> config{}; + std::optional<std::filesystem::path> endpoint_configuration{}; }; // corresponding to the similarly-named arguments in 'just' diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp index 4e9403a8..2c771836 100644 --- a/src/other_tools/just_mr/launch.cpp +++ b/src/other_tools/just_mr/launch.cpp @@ -48,6 +48,7 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, bool use_launcher{false}; bool supports_defines{false}; bool supports_remote{false}; + bool supports_dispatch{false}; bool supports_cacert{false}; bool supports_client_auth{false}; std::optional<std::filesystem::path> mr_config_path{std::nullopt}; @@ -81,6 +82,7 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, use_launcher = kKnownJustSubcommands.at(*subcommand).launch; supports_defines = kKnownJustSubcommands.at(*subcommand).defines; supports_remote = kKnownJustSubcommands.at(*subcommand).remote; + supports_dispatch = kKnownJustSubcommands.at(*subcommand).dispatch; supports_cacert = kKnownJustSubcommands.at(*subcommand).cacert; supports_client_auth = kKnownJustSubcommands.at(*subcommand).client_auth; @@ -121,6 +123,10 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, cmd.emplace_back("--plain-log"); } if (supports_defines) { + if (just_cmd_args.config) { + cmd.emplace_back("-c"); + cmd.emplace_back(just_cmd_args.config->string()); + } auto overlay_config = Configuration(); for (auto const& s : common_args.defines) { try { @@ -153,6 +159,10 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, cmd.emplace_back("-r"); cmd.emplace_back(*common_args.remote_execution_address); } + if (supports_dispatch and just_cmd_args.endpoint_configuration) { + cmd.emplace_back("--endpoint-configuration"); + cmd.emplace_back(*just_cmd_args.endpoint_configuration); + } if (supports_remote and common_args.remote_serve_address) { cmd.emplace_back("--remote-serve-address"); cmd.emplace_back(*common_args.remote_serve_address); diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp index 63e772bf..d8b8067a 100644 --- a/src/other_tools/just_mr/rc.cpp +++ b/src/other_tools/just_mr/rc.cpp @@ -103,6 +103,30 @@ namespace { std::filesystem::weakly_canonical( std::filesystem::absolute(root_path / base))); } + +[[nodiscard]] auto ReadOptionalLocationList( + ExpressionPtr const& location_list, + std::optional<std::filesystem::path> const& ws_root, + std::string const& argument_name) -> std::optional<std::filesystem::path> { + if (location_list->IsNone()) { + return std::nullopt; + } + if (not location_list->IsList()) { + Logger::Log(LogLevel::Error, + "Argument {} has to be a list, but found {}", + argument_name, + location_list->ToString()); + std::exit(kExitConfigError); + } + for (auto const& location : location_list->List()) { + auto p = ReadLocation(location, ws_root); + if (p and FileSystemManager::IsFile(p->first)) { + return p->first; + } + } + return std::nullopt; +} + } // namespace /// \brief Read just-mrrc file and set up various configs. Return the path to @@ -216,6 +240,26 @@ namespace { clargs->common.git_path = git->first; } } + // read the just file-arguments + auto just_files = rc_config["just files"]; + if (just_files.IsNotNull()) { + if (not just_files->IsMap()) { + Logger::Log(LogLevel::Error, + "Configration-file provided 'just files' has to be a " + "map, but found {}.", + just_files->ToString()); + std::exit(kExitConfigError); + } + auto files = Configuration(just_files); + clargs->just_cmd.config = ReadOptionalLocationList( + files["config"], + clargs->common.just_mr_paths->workspace_root, + "'config' in 'just files'"); + clargs->just_cmd.endpoint_configuration = ReadOptionalLocationList( + files["endpoint-configuration"], + clargs->common.just_mr_paths->workspace_root, + "'endpoint-configuration' in 'just files'"); + } // read additional just args; user can append, but does not overwrite auto just_args = rc_config["just args"]; if (just_args.IsNotNull()) { diff --git a/src/other_tools/just_mr/utils.hpp b/src/other_tools/just_mr/utils.hpp index 0fc18748..54abd3d5 100644 --- a/src/other_tools/just_mr/utils.hpp +++ b/src/other_tools/just_mr/utils.hpp @@ -50,6 +50,7 @@ struct JustSubCmdFlags { bool launch; // supports the local launcher arg bool defines; // supports defines arg bool remote; // supports remote exec args + bool dispatch; // supports dispatching of the remote-execution endpoint bool cacert; // supports CA cert arg bool client_auth; // supports client auth args }; @@ -62,6 +63,7 @@ std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{ .launch = false, .defines = false, .remote = false, + .dispatch = false, .cacert = false, .client_auth = false}}, {"describe", @@ -70,6 +72,7 @@ std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{ .launch = false, .defines = true, .remote = false, + .dispatch = false, .cacert = false, .client_auth = false}}, {"analyse", @@ -78,6 +81,7 @@ std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{ .launch = false, .defines = true, .remote = true, + .dispatch = true, .cacert = false, .client_auth = false}}, {"build", @@ -86,6 +90,7 @@ std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{ .launch = true, .defines = true, .remote = true, + .dispatch = true, .cacert = true, .client_auth = true}}, {"install", @@ -94,6 +99,7 @@ std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{ .launch = true, .defines = true, .remote = true, + .dispatch = true, .cacert = true, .client_auth = true}}, {"rebuild", @@ -102,6 +108,7 @@ std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{ .launch = true, .defines = true, .remote = true, + .dispatch = true, .cacert = true, .client_auth = true}}, {"install-cas", @@ -110,6 +117,7 @@ std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{ .launch = false, .defines = false, .remote = true, + .dispatch = false, .cacert = true, .client_auth = true}}, {"gc", @@ -118,6 +126,7 @@ std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{ .launch = false, .defines = false, .remote = false, + .dispatch = false, .cacert = false, .client_auth = false}}}; |