diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-28 17:04:15 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-03-24 09:33:46 +0100 |
commit | fedaa03fe9f90c84f5dbc966872aeefe8d72772c (patch) | |
tree | df26a54f4418b758816a37f236d28325d82deda8 /src | |
parent | 538c7f3e180a5f121c6819ad5d9b14f843512f60 (diff) | |
download | justbuild-fedaa03fe9f90c84f5dbc966872aeefe8d72772c.tar.gz |
LocalApi: Use file sources of ArtifactBlobs.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/local/local_api.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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<ArtifactBlob>&& blobs, blobs.begin(), blobs.end(), [&cas = local_context_.storage->CAS()](ArtifactBlob const& blob) { + bool const is_tree = blob.GetDigest().IsTree(); + std::optional<ArtifactDigest> 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<kOwner>(*path) + : cas.StoreBlob<kOwner>(*path, blob.IsExecutable()); + } + else if (auto const content = blob.ReadContent()) { + cas_digest = is_tree ? cas.StoreTree(*content) : cas.StoreBlob(*content, blob.IsExecutable()); } |