diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-25 13:42:22 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-27 09:03:30 +0100 |
commit | 461312b57d3b49f92861d2c6c5e8a6b13ffa839b (patch) | |
tree | c642cd0d3379e6886d1b3847d38661e249e75d58 /src/buildtool/execution_api/common | |
parent | eccc7dcfb22fb9c6c42bbcd5566cd044acd1a2f3 (diff) | |
download | justbuild-461312b57d3b49f92861d2c6c5e8a6b13ffa839b.tar.gz |
ArtifactBlob: Use static function for construction
Diffstat (limited to 'src/buildtool/execution_api/common')
-rw-r--r-- | src/buildtool/execution_api/common/TARGETS | 3 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/blob_tree.cpp | 19 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS index 6eeb3931..39ccc042 100644 --- a/src/buildtool/execution_api/common/TARGETS +++ b/src/buildtool/execution_api/common/TARGETS @@ -133,8 +133,7 @@ , ["src/buildtool/execution_api/bazel_msg", "directory_tree"] ] , "private-deps": - [ ["src/buildtool/common", "artifact_digest_factory"] - , ["src/buildtool/common", "common"] + [ ["src/buildtool/common", "common"] , ["src/buildtool/crypto", "hash_function"] , ["src/buildtool/file_system", "git_repo"] , ["src/buildtool/file_system", "object_type"] diff --git a/src/buildtool/execution_api/common/blob_tree.cpp b/src/buildtool/execution_api/common/blob_tree.cpp index 7224406a..e6d8fc2c 100644 --- a/src/buildtool/execution_api/common/blob_tree.cpp +++ b/src/buildtool/execution_api/common/blob_tree.cpp @@ -22,7 +22,6 @@ #include "src/buildtool/common/artifact.hpp" #include "src/buildtool/common/artifact_digest.hpp" -#include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/file_system/git_repo.hpp" #include "src/buildtool/file_system/object_type.hpp" @@ -68,17 +67,13 @@ auto BlobTree::FromDirectoryTree(DirectoryTreePtr const& tree, } } if (auto git_tree = GitRepo::CreateShallowTree(entries)) { - auto digest = - ArtifactDigestFactory::Create(HashFunction::Type::GitSHA1, - ToHexString(git_tree->first), - git_tree->second.size(), - /*is_tree=*/true); - if (digest) { - return std::make_shared<BlobTree>( - ArtifactBlob{*std::move(digest), - git_tree->second, - /*is_exec=*/false}, - nodes); + auto blob = ArtifactBlob::FromMemory( + HashFunction{HashFunction::Type::GitSHA1}, + ObjectType::Tree, + std::move(git_tree)->second); + if (blob.has_value()) { + return std::make_shared<BlobTree>(*std::move(blob), + std::move(nodes)); } } } catch (...) { |