diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/main/main.cpp | 18 | ||||
-rw-r--r-- | src/buildtool/storage/TARGETS | 1 | ||||
-rw-r--r-- | src/buildtool/storage/config.hpp | 26 |
3 files changed, 17 insertions, 28 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index bc159f6c..544027ca 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -134,16 +134,22 @@ void SetupLogging(LogArguments const& clargs) { builder.SetBuildRoot(*eargs.local_root); } + auto backend_description = BackendDescription::Describe( + remote_address, remote_platform_properties, remote_dispatch); + if (not backend_description) { + Logger::Log(LogLevel::Error, std::move(backend_description).error()); + return std::nullopt; + } + auto config = builder.SetHashType(hash_type) - .SetRemoteExecutionArgs( - remote_address, remote_platform_properties, remote_dispatch) + .SetBackendDescription(std::move(backend_description).value()) .Build(); - if (config) { - return *std::move(config); + if (not config) { + Logger::Log(LogLevel::Error, std::move(config).error()); + return std::nullopt; } - Logger::Log(LogLevel::Error, config.error()); - return std::nullopt; + return *std::move(config); } #ifndef BOOTSTRAP_BUILD_TOOL diff --git a/src/buildtool/storage/TARGETS b/src/buildtool/storage/TARGETS index 81a8ae26..8358825d 100644 --- a/src/buildtool/storage/TARGETS +++ b/src/buildtool/storage/TARGETS @@ -9,7 +9,6 @@ , ["src/buildtool/common", "artifact_digest_factory"] , ["src/buildtool/common", "common"] , ["src/buildtool/common", "protocol_traits"] - , ["src/buildtool/common/remote", "remote_common"] , ["src/buildtool/crypto", "hash_function"] , ["src/buildtool/file_system", "file_system_manager"] , ["src/buildtool/file_system", "object_type"] diff --git a/src/buildtool/storage/config.hpp b/src/buildtool/storage/config.hpp index fdfcfbb7..493c00b2 100644 --- a/src/buildtool/storage/config.hpp +++ b/src/buildtool/storage/config.hpp @@ -20,14 +20,12 @@ #include <optional> #include <string> #include <utility> -#include <vector> #include "fmt/core.h" #include "gsl/gsl" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/common/protocol_traits.hpp" -#include "src/buildtool/common/remote/remote_common.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/object_type.hpp" @@ -179,13 +177,8 @@ class StorageConfig::Builder final { return *this; } - auto SetRemoteExecutionArgs(std::optional<ServerAddress> address, - ExecutionProperties properties, - std::vector<DispatchEndpoint> dispatch) noexcept - -> Builder& { - remote_address_ = std::move(address); - remote_platform_properties_ = std::move(properties); - remote_dispatch_ = std::move(dispatch); + auto SetBackendDescription(BackendDescription value) noexcept -> Builder& { + backend_description_ = std::move(value); return *this; } @@ -220,17 +213,12 @@ class StorageConfig::Builder final { // Hash the execution backend description auto backend_description_id = default_config.backend_description_id; - auto desc = BackendDescription::Describe( - remote_address_, remote_platform_properties_, remote_dispatch_); - if (desc) { + if (backend_description_) { backend_description_id = ArtifactDigestFactory::HashDataAs<ObjectType::File>( - hash_function, desc->GetDescription()) + hash_function, backend_description_->GetDescription()) .hash(); } - else { - return unexpected{desc.error()}; - } return StorageConfig{ .build_root = std::move(build_root), @@ -243,11 +231,7 @@ class StorageConfig::Builder final { std::optional<std::filesystem::path> build_root_; std::optional<std::size_t> num_generations_; std::optional<HashFunction::Type> hash_type_; - - // Fields for computing remote execution backend description - std::optional<ServerAddress> remote_address_; - ExecutionProperties remote_platform_properties_; - std::vector<DispatchEndpoint> remote_dispatch_; + std::optional<BackendDescription> backend_description_; }; #endif // INCLUDED_SRC_BUILDTOOL_STORAGE_CONFIG_HPP |