From fedaa03fe9f90c84f5dbc966872aeefe8d72772c Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Fri, 28 Feb 2025 17:04:15 +0100 Subject: LocalApi: Use file sources of ArtifactBlobs. --- src/buildtool/execution_api/local/local_api.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/buildtool/execution_api/local/local_api.cpp b/src/buildtool/execution_api/local/local_api.cpp index eef05021..3eede672 100644 --- a/src/buildtool/execution_api/local/local_api.cpp +++ b/src/buildtool/execution_api/local/local_api.cpp @@ -217,9 +217,17 @@ auto LocalApi::Upload(std::unordered_set&& blobs, blobs.begin(), blobs.end(), [&cas = local_context_.storage->CAS()](ArtifactBlob const& blob) { + bool const is_tree = blob.GetDigest().IsTree(); + std::optional cas_digest; - if (auto const content = blob.ReadContent()) { - cas_digest = blob.GetDigest().IsTree() + if (auto const path = blob.GetFilePath()) { + static constexpr bool kOwner = true; + cas_digest = + is_tree ? cas.StoreTree(*path) + : cas.StoreBlob(*path, blob.IsExecutable()); + } + else if (auto const content = blob.ReadContent()) { + cas_digest = is_tree ? cas.StoreTree(*content) : cas.StoreBlob(*content, blob.IsExecutable()); } -- cgit v1.2.3