From 600876757ffe49248c34bab33d0d9247e60232f0 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 7 Mar 2023 15:35:10 +0100 Subject: TargetCache: Drop dependency on execution api --- .../build_engine/target_map/target_cache.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/buildtool/build_engine/target_map/target_cache.cpp') diff --git a/src/buildtool/build_engine/target_map/target_cache.cpp b/src/buildtool/build_engine/target_map/target_cache.cpp index 48e761fd..3e149ddd 100644 --- a/src/buildtool/build_engine/target_map/target_cache.cpp +++ b/src/buildtool/build_engine/target_map/target_cache.cpp @@ -28,11 +28,13 @@ #endif auto TargetCache::Store(TargetCacheKey const& key, - TargetCacheEntry const& value) const noexcept -> bool { + TargetCacheEntry const& value, + ArtifactDownloader const& downloader) const noexcept + -> bool { // Before a target-cache entry is stored in local CAS, make sure any created // artifact for this target is downloaded from the remote CAS to the local // CAS. - if (not DownloadKnownArtifacts(value)) { + if (not DownloadKnownArtifacts(value, downloader)) { return false; } if (auto digest = CAS().StoreBlobFromBytes(value.ToJson().dump(2))) { @@ -89,17 +91,11 @@ auto TargetCache::Read(TargetCacheKey const& key) const noexcept } auto TargetCache::DownloadKnownArtifacts( - TargetCacheEntry const& value) const noexcept -> bool { + TargetCacheEntry const& value, + ArtifactDownloader const& downloader) const noexcept -> bool { std::vector artifacts_info; - if (not value.ToArtifacts(&artifacts_info)) { - return false; - } -#ifndef BOOTSTRAP_BUILD_TOOL - // Sync KNOWN artifacts from remote to local CAS. - return remote_api_->RetrieveToCas(artifacts_info, local_api_); -#else - return true; -#endif + return downloader and value.ToArtifacts(&artifacts_info) and + downloader(artifacts_info); } auto TargetCache::ComputeCacheDir(int index) -> std::filesystem::path { -- cgit v1.2.3