diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-26 16:27:46 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-30 12:10:06 +0200 |
commit | d1293c8f9147375fa70d5dce1c0d38988300bc95 (patch) | |
tree | 29e4794455f7bf3a2d2e7deecd4e9b47f236916b | |
parent | 138c171f3d3c24642074329a303932f46e9f19d1 (diff) | |
download | justbuild-d1293c8f9147375fa70d5dce1c0d38988300bc95.tar.gz |
Use RemoteContext in install_cas
-rw-r--r-- | src/buildtool/main/TARGETS | 3 | ||||
-rw-r--r-- | src/buildtool/main/install_cas.cpp | 7 | ||||
-rw-r--r-- | src/buildtool/main/install_cas.hpp | 8 | ||||
-rw-r--r-- | src/buildtool/main/main.cpp | 3 |
4 files changed, 12 insertions, 9 deletions
diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS index 5ff6bcbd..5e4bf519 100644 --- a/src/buildtool/main/TARGETS +++ b/src/buildtool/main/TARGETS @@ -129,13 +129,12 @@ [ ["src/buildtool/common", "cli"] , ["src/buildtool/common", "common"] , ["src/buildtool/execution_api/common", "api_bundle"] - , ["@", "gsl", "", "gsl"] + , ["src/buildtool/execution_api/remote", "context"] ] , "stage": ["src", "buildtool", "main"] , "private-deps": [ ["src/buildtool/compatibility", "compatibility"] , ["src/buildtool/crypto", "hash_function"] - , ["src/buildtool/execution_api/remote", "config"] , ["src/buildtool/logging", "log_level"] , ["src/buildtool/logging", "logging"] , ["src/buildtool/execution_api/utils", "subobject"] diff --git a/src/buildtool/main/install_cas.cpp b/src/buildtool/main/install_cas.cpp index 024d22c7..1f5873e1 100644 --- a/src/buildtool/main/install_cas.cpp +++ b/src/buildtool/main/install_cas.cpp @@ -18,7 +18,6 @@ #include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/crypto/hash_function.hpp" -#include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" #ifndef BOOTSTRAP_BUILD_TOOL @@ -77,9 +76,11 @@ namespace { #ifndef BOOTSTRAP_BUILD_TOOL auto FetchAndInstallArtifacts(ApiBundle const& apis, - FetchArguments const& clargs) -> bool { + FetchArguments const& clargs, + RemoteContext const& remote_context) -> bool { auto object_info = ObjectInfoFromLiberalString( - clargs.object_id, apis.remote_config.remote_address.has_value()); + clargs.object_id, + remote_context.exec_config->remote_address.has_value()); if (clargs.remember) { if (not apis.remote->ParallelRetrieveToCas( diff --git a/src/buildtool/main/install_cas.hpp b/src/buildtool/main/install_cas.hpp index 9ca0a638..97324569 100644 --- a/src/buildtool/main/install_cas.hpp +++ b/src/buildtool/main/install_cas.hpp @@ -17,20 +17,22 @@ #include <string> -#include "gsl/gsl" #include "src/buildtool/common/artifact.hpp" -#include "src/buildtool/common/cli.hpp" #ifndef BOOTSTRAP_BUILD_TOOL +#include "src/buildtool/common/cli.hpp" #include "src/buildtool/execution_api/common/api_bundle.hpp" +#include "src/buildtool/execution_api/remote/context.hpp" #endif +/// \note Method is public for use also in tests. [[nodiscard]] auto ObjectInfoFromLiberalString(std::string const& s, bool has_remote) noexcept -> Artifact::ObjectInfo; #ifndef BOOTSTRAP_BUILD_TOOL [[nodiscard]] auto FetchAndInstallArtifacts(ApiBundle const& apis, - FetchArguments const& clargs) + FetchArguments const& clargs, + RemoteContext const& remote_context) -> bool; #endif diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index c76b57ce..18caa871 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -1008,7 +1008,8 @@ auto main(int argc, char* argv[]) -> int { "Failed set Git CAS {}.", storage_config->GitRoot().string()); } - return FetchAndInstallArtifacts(main_apis, arguments.fetch) + return FetchAndInstallArtifacts( + main_apis, arguments.fetch, remote_context) ? kExitSuccess : kExitFailure; } |