diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/common/cli.hpp | 10 | ||||
-rw-r--r-- | src/buildtool/main/cli.cpp | 4 | ||||
-rw-r--r-- | src/buildtool/main/main.cpp | 8 | ||||
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 5 | ||||
-rw-r--r-- | src/other_tools/just_mr/launch.cpp | 4 | ||||
-rw-r--r-- | src/other_tools/just_mr/main.cpp | 24 |
6 files changed, 55 insertions, 0 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index c90e54f9..a1438400 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -160,6 +160,7 @@ struct ServiceArguments { struct ServeArguments { std::filesystem::path config{}; + std::optional<std::string> remote_serve_address{}; // repositories populated from just-serve config file std::vector<std::filesystem::path> repositories{}; }; @@ -403,6 +404,15 @@ static inline auto SetupEndpointArguments( ->expected(1, 1); } +static inline auto SetupServeEndpointArguments( + gsl::not_null<CLI::App*> const& app, + gsl::not_null<ServeArguments*> const& clargs) { + app->add_option("--remote-serve-address", + clargs->remote_serve_address, + "Address of the serve service.") + ->type_name("NAME:PORT"); +} + static inline auto SetupCommonBuildArguments( gsl::not_null<CLI::App*> const& app, gsl::not_null<BuildArguments*> const& clargs) { diff --git a/src/buildtool/main/cli.cpp b/src/buildtool/main/cli.cpp index f7e1ea71..5e5dc651 100644 --- a/src/buildtool/main/cli.cpp +++ b/src/buildtool/main/cli.cpp @@ -39,6 +39,7 @@ auto SetupAnalyseCommandArguments( SetupAnalysisArguments(app, &clargs->analysis); SetupCacheArguments(app, &clargs->endpoint); SetupEndpointArguments(app, &clargs->endpoint); + SetupServeEndpointArguments(app, &clargs->serve); SetupDiagnosticArguments(app, &clargs->diagnose); SetupCompatibilityArguments(app); } @@ -52,6 +53,7 @@ auto SetupBuildCommandArguments( SetupAnalysisArguments(app, &clargs->analysis); SetupCacheArguments(app, &clargs->endpoint); SetupEndpointArguments(app, &clargs->endpoint); + SetupServeEndpointArguments(app, &clargs->serve); SetupCommonAuthArguments(app, &clargs->auth); SetupClientAuthArguments(app, &clargs->cauth); SetupCommonBuildArguments(app, &clargs->build); @@ -82,6 +84,7 @@ auto SetupInstallCasCommandArguments( SetupCompatibilityArguments(app); SetupCacheArguments(app, &clargs->endpoint); SetupEndpointArguments(app, &clargs->endpoint); + SetupServeEndpointArguments(app, &clargs->serve); SetupCommonAuthArguments(app, &clargs->auth); SetupClientAuthArguments(app, &clargs->cauth); SetupFetchArguments(app, &clargs->fetch); @@ -96,6 +99,7 @@ auto SetupTraverseCommandArguments( SetupLogArguments(app, &clargs->log); SetupCacheArguments(app, &clargs->endpoint); SetupEndpointArguments(app, &clargs->endpoint); + SetupServeEndpointArguments(app, &clargs->serve); SetupCommonAuthArguments(app, &clargs->auth); SetupClientAuthArguments(app, &clargs->cauth); SetupGraphArguments(app, &clargs->graph); // instead of analysis diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 8cc81449..880c0e85 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -136,6 +136,14 @@ void SetupExecutionConfig(EndpointArguments const& eargs, void SetupServeConfig(ServeArguments const& srvargs) { using RemoteConfig = RemoteServeConfig; + if (srvargs.remote_serve_address) { + if (not RemoteConfig::SetRemoteAddress(*srvargs.remote_serve_address)) { + Logger::Log(LogLevel::Error, + "setting serve service address '{}' failed.", + *srvargs.remote_serve_address); + std::exit(kExitFailure); + } + } if (not srvargs.repositories.empty() and not RemoteConfig::SetKnownRepositories(srvargs.repositories)) { Logger::Log(LogLevel::Error, diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 484665a5..22c401ba 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -47,6 +47,7 @@ struct MultiRepoCommonArguments { std::vector<std::string> defines{}; std::optional<std::string> remote_execution_address; std::optional<bool> compatible{std::nullopt}; + std::optional<std::string> remote_serve_address; }; struct MultiRepoLogArguments { @@ -187,6 +188,10 @@ static inline void SetupMultiRepoCommonArguments( "At increased computational effort, be compatible with the original " "remote build execution protocol. As the change affects identifiers, " "the flag must be used consistently for all related invocations."); + app->add_option("--remote-serve-address", + clargs->remote_serve_address, + "Address of a remote 'just serve' service.") + ->type_name("NAME:PORT"); } static inline auto SetupMultiRepoLogArguments( diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp index c843d3c1..26b87059 100644 --- a/src/other_tools/just_mr/launch.cpp +++ b/src/other_tools/just_mr/launch.cpp @@ -152,6 +152,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_remote and common_args.remote_serve_address) { + cmd.emplace_back("--remote-serve-address"); + cmd.emplace_back(*common_args.remote_serve_address); + } // forward mutual TLS arguments if (supports_cacert and auth_args.tls_ca_cert) { cmd.emplace_back("--tls-ca-cert"); diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 6ca10205..85105e50 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -531,6 +531,30 @@ void SetupLogging(MultiRepoLogArguments const& clargs) { } } } + // read remote exec args; overwritten if user provided it already + auto serve = rc_config["remote serve"]; + if (serve.IsNotNull()) { + if (not serve->IsMap()) { + Logger::Log(LogLevel::Error, + "Configuration-provided remote serve service arguments " + "has to be a map, but found {}", + serve->ToString()); + std::exit(kExitConfigError); + } + if (not clargs->common.remote_execution_address) { + auto addr = serve->Get("address", Expression::none_t{}); + if (addr.IsNotNull()) { + if (not addr->IsString()) { + Logger::Log(LogLevel::Error, + "Configuration-provided remote serve service " + "address has to be a string, but found {}", + addr->ToString()); + std::exit(kExitConfigError); + } + clargs->common.remote_execution_address = addr->String(); + } + } + } // read authentication args; overwritten if user provided it already auto auth_args = rc_config["authentication"]; if (auth_args.IsNotNull()) { |