summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-17 17:04:13 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-19 09:50:37 +0200
commit73ad97ca278f5afe1e4d6c7bb2484f6998c754dd (patch)
tree4ffaea37137b0e011fdc29868b9217f9f0d6f141 /src
parente91d4e8a1b9c2a2b95b2105c5c39515abd791733 (diff)
downloadjustbuild-73ad97ca278f5afe1e4d6c7bb2484f6998c754dd.tar.gz
just: Minimize needed config for 'just execute'
As 'just execute' does not actually use the remote api, the configuration instances created for it can be streamlined or moved out of its scope.
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/main/main.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 2efecb87..ffff2985 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -819,12 +819,6 @@ auto main(int argc, char* argv[]) -> int {
return kExitFailure;
}
- auto serve_config = CreateServeConfig(
- arguments.serve, arguments.common, arguments.build, arguments.tc);
- if (not serve_config) {
- return kExitFailure;
- }
-
auto auth_config =
CreateAuthConfig(arguments.auth, arguments.cauth, arguments.sauth);
if (not auth_config) {
@@ -832,25 +826,16 @@ auto main(int argc, char* argv[]) -> int {
}
if (arguments.cmd == SubCommand::kExecute) {
- // Set up remote execution config.
- auto remote_exec_config = CreateRemoteExecutionConfig(
- arguments.endpoint, arguments.rebuild);
- if (not remote_exec_config) {
- return kExitFailure;
- }
+ // Use default remote configuration.
+ RemoteExecutionConfig remote_exec_config{};
- // Set up storage for server-side operation.
- auto const storage_config =
- CreateStorageConfig(arguments.endpoint,
- remote_exec_config->remote_address,
- remote_exec_config->platform_properties,
- remote_exec_config->dispatch);
+ // Set up storage for local execution.
+ auto const storage_config = CreateStorageConfig(arguments.endpoint);
if (not storage_config) {
return kExitFailure;
}
auto const storage = Storage::Create(&*storage_config);
- StoreTargetCacheShard(
- *storage_config, storage, *remote_exec_config);
+ StoreTargetCacheShard(*storage_config, storage, remote_exec_config);
SetupExecutionServiceConfig(arguments.service);
ApiBundle const exec_apis{&*storage_config,
@@ -858,7 +843,7 @@ auto main(int argc, char* argv[]) -> int {
&*local_exec_config,
/*repo_config=*/nullptr,
&*auth_config,
- &*remote_exec_config};
+ &remote_exec_config};
if (not ServerImpl::Instance().Run(
*storage_config, storage, exec_apis)) {
return kExitFailure;
@@ -866,6 +851,12 @@ auto main(int argc, char* argv[]) -> int {
return kExitSuccess;
}
+ auto serve_config = CreateServeConfig(
+ arguments.serve, arguments.common, arguments.build, arguments.tc);
+ if (not serve_config) {
+ return kExitFailure;
+ }
+
if (arguments.cmd == SubCommand::kServe) {
auto serve_server =
ServeServerImpl::Create(arguments.service.interface,
@@ -880,7 +871,7 @@ auto main(int argc, char* argv[]) -> int {
return kExitFailure;
}
- // Set up storage for server-side operation.
+ // Set up storage for serve operation.
auto const storage_config =
CreateStorageConfig(arguments.endpoint,
remote_exec_config->remote_address,