diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-03-07 15:35:10 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-03-13 17:28:59 +0100 |
commit | 600876757ffe49248c34bab33d0d9247e60232f0 (patch) | |
tree | 46222384693cf36b8306cce7030b5bde482deed4 /src/buildtool/build_engine/target_map/target_cache.cpp | |
parent | f4cbd6a77213d12884a767e65da71d77a0fbf3ac (diff) | |
download | justbuild-600876757ffe49248c34bab33d0d9247e60232f0.tar.gz |
TargetCache: Drop dependency on execution api
Diffstat (limited to 'src/buildtool/build_engine/target_map/target_cache.cpp')
-rw-r--r-- | src/buildtool/build_engine/target_map/target_cache.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
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<Artifact::ObjectInfo> 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 { |