From de3ef374983d987d8ffd8e8516a4877fe68b3e4e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 8 Jul 2024 16:50:01 +0200 Subject: Use RemoteExecutionConfig instances stored in ApiBundle ...wherever an ApiBundle is already being passed. --- src/buildtool/main/install_cas.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/buildtool/main/install_cas.cpp') diff --git a/src/buildtool/main/install_cas.cpp b/src/buildtool/main/install_cas.cpp index 2e1b6917..dcf696ab 100644 --- a/src/buildtool/main/install_cas.cpp +++ b/src/buildtool/main/install_cas.cpp @@ -30,17 +30,19 @@ namespace { [[nodiscard]] auto InvalidSizeString(std::string const& size_str, - std::string const& hash) noexcept -> bool { + std::string const& hash, + bool has_remote) noexcept -> bool { static auto const kEmptyHash = HashFunction::ComputeBlobHash(""); return Compatibility::IsCompatible() and // native mode is fine (size_str == "0" or size_str.empty()) and // not "0" or "" is fine kEmptyHash.HexString() != hash and // empty hash is fine - RemoteExecutionConfig::RemoteAddress(); // local is fine + has_remote; // local is fine } } // namespace -[[nodiscard]] auto ObjectInfoFromLiberalString(std::string const& s) noexcept +[[nodiscard]] auto ObjectInfoFromLiberalString(std::string const& s, + bool has_remote) noexcept -> Artifact::ObjectInfo { std::istringstream iss(s); std::string id{}; @@ -56,7 +58,7 @@ namespace { if (not iss.eof()) { std::getline(iss, type, ']'); } - if (InvalidSizeString(size_str, id)) { + if (InvalidSizeString(size_str, id, has_remote)) { Logger::Log( LogLevel::Warning, "{} size in object-id is not supported in compatiblity mode.", @@ -73,7 +75,8 @@ namespace { #ifndef BOOTSTRAP_BUILD_TOOL auto FetchAndInstallArtifacts(ApiBundle const& apis, FetchArguments const& clargs) -> bool { - auto object_info = ObjectInfoFromLiberalString(clargs.object_id); + auto object_info = ObjectInfoFromLiberalString( + clargs.object_id, apis.remote_config.RemoteAddress().has_value()); if (clargs.remember) { if (not apis.remote->ParallelRetrieveToCas( -- cgit v1.2.3