summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/storage/target_cache.hpp5
-rw-r--r--src/buildtool/storage/target_cache.tpp19
2 files changed, 23 insertions, 1 deletions
diff --git a/src/buildtool/storage/target_cache.hpp b/src/buildtool/storage/target_cache.hpp
index f263fdf9..385d1cd0 100644
--- a/src/buildtool/storage/target_cache.hpp
+++ b/src/buildtool/storage/target_cache.hpp
@@ -123,6 +123,11 @@ class TargetCache {
/*kSetEpochTime=*/false>
file_store_;
+ template <bool kIsLocalGeneration = not kDoGlobalUplink>
+ requires(kIsLocalGeneration) [[nodiscard]] auto LocalUplinkEntry(
+ LocalGenerationTC const& latest,
+ std::string const& key_digest) const noexcept -> bool;
+
[[nodiscard]] static auto ComputeShard() noexcept -> std::string {
return ArtifactDigest::Create<ObjectType::File>(
StorageConfig::ExecutionBackendDescription())
diff --git a/src/buildtool/storage/target_cache.tpp b/src/buildtool/storage/target_cache.tpp
index d1c9d01c..cd56ef59 100644
--- a/src/buildtool/storage/target_cache.tpp
+++ b/src/buildtool/storage/target_cache.tpp
@@ -87,8 +87,15 @@ requires(kIsLocalGeneration) auto TargetCache<
kDoGlobalUplink>::LocalUplinkEntry(LocalGenerationTC const& latest,
TargetCacheKey const& key) const noexcept
-> bool {
+ return LocalUplinkEntry(latest, key.Id().digest.hash());
+}
+
+template <bool kDoGlobalUplink>
+template <bool kIsLocalGeneration>
+requires(kIsLocalGeneration) auto TargetCache<kDoGlobalUplink>::
+ LocalUplinkEntry(LocalGenerationTC const& latest,
+ std::string const& key_digest) const noexcept -> bool {
// Determine target cache key path of given generation.
- auto key_digest = key.Id().digest.hash();
if (FileSystemManager::IsFile(latest.file_store_.GetPath(key_digest))) {
return true;
}
@@ -125,6 +132,16 @@ requires(kIsLocalGeneration) auto TargetCache<
return false;
}
auto entry = TargetCacheEntry::FromJson(json_desc);
+
+ // Uplink the implied export targets first
+ for (auto const& implied_digest : entry.ToImplied()) {
+ if (implied_digest != key_digest) {
+ if (not LocalUplinkEntry(latest, implied_digest)) {
+ return false;
+ }
+ }
+ }
+
std::vector<Artifact::ObjectInfo> artifacts_info;
if (not entry.ToArtifacts(&artifacts_info)) {
return false;