diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-05 17:27:13 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-22 17:01:13 +0200 |
commit | dd23c6e397584f4bf1cf84a73d9c382a8ff81de7 (patch) | |
tree | 0f0f600a4674a03da42c07f4ea016ff3c2dc578e /src/buildtool/execution_api/local | |
parent | beb3faa6956b9bfd58d4ea6644a9b2987409aaba (diff) | |
download | justbuild-dd23c6e397584f4bf1cf84a73d9c382a8ff81de7.tar.gz |
Pass HashFunction to ArtifactDigest::Create
Diffstat (limited to 'src/buildtool/execution_api/local')
-rw-r--r-- | src/buildtool/execution_api/local/TARGETS | 1 | ||||
-rw-r--r-- | src/buildtool/execution_api/local/local_api.hpp | 7 | ||||
-rw-r--r-- | src/buildtool/execution_api/local/local_response.hpp | 9 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/buildtool/execution_api/local/TARGETS b/src/buildtool/execution_api/local/TARGETS index 53b7f717..682c8624 100644 --- a/src/buildtool/execution_api/local/TARGETS +++ b/src/buildtool/execution_api/local/TARGETS @@ -42,6 +42,7 @@ , ["src/buildtool/execution_api/execution_service", "cas_utils"] , ["src/buildtool/file_system", "git_repo"] , ["src/utils/cpp", "tmp_dir"] + , ["src/buildtool/crypto", "hash_function"] ] , "stage": ["src", "buildtool", "execution_api", "local"] , "private-deps": diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp index 5f8fb6a4..e8ba0831 100644 --- a/src/buildtool/execution_api/local/local_api.hpp +++ b/src/buildtool/execution_api/local/local_api.hpp @@ -34,6 +34,7 @@ #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/compatibility/native_support.hpp" +#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" #include "src/buildtool/execution_api/common/artifact_blob_container.hpp" #include "src/buildtool/execution_api/common/blob_tree.hpp" @@ -214,8 +215,10 @@ class LocalApi final : public IExecutionApi { // storage_.ReadTreeInfos() will contain 0 as size. ArtifactDigest digest = IsTreeObject(info.type) - ? ArtifactDigest::Create<ObjectType::Tree>(*content) - : ArtifactDigest::Create<ObjectType::File>(*content); + ? ArtifactDigest::Create<ObjectType::Tree>( + HashFunction::Instance(), *content) + : ArtifactDigest::Create<ObjectType::File>( + HashFunction::Instance(), *content); // Collect blob and upload to remote CAS if transfer size reached. if (not UpdateContainerAndUpload<ArtifactDigest>( diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp index 30d47ca7..c6214320 100644 --- a/src/buildtool/execution_api/local/local_response.hpp +++ b/src/buildtool/execution_api/local/local_response.hpp @@ -20,6 +20,7 @@ #include <utility> #include "gsl/gsl" +#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/execution_response.hpp" #include "src/buildtool/execution_api/local/local_action.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" @@ -139,7 +140,7 @@ class LocalResponse final : public IExecutionResponse { link.path(), Artifact::ObjectInfo{ .digest = ArtifactDigest::Create<ObjectType::File>( - link.target()), + HashFunction::Instance(), link.target()), .type = ObjectType::Symlink}); } catch (...) { return false; @@ -151,7 +152,7 @@ class LocalResponse final : public IExecutionResponse { link.path(), Artifact::ObjectInfo{ .digest = ArtifactDigest::Create<ObjectType::File>( - link.target()), + HashFunction::Instance(), link.target()), .type = ObjectType::Symlink}); dir_symlinks.emplace(link.path()); // add it to set } catch (...) { @@ -166,7 +167,7 @@ class LocalResponse final : public IExecutionResponse { link.path(), Artifact::ObjectInfo{ .digest = ArtifactDigest::Create<ObjectType::File>( - link.target()), + HashFunction::Instance(), link.target()), .type = ObjectType::Symlink}); } catch (...) { return false; @@ -178,7 +179,7 @@ class LocalResponse final : public IExecutionResponse { link.path(), Artifact::ObjectInfo{ .digest = ArtifactDigest::Create<ObjectType::File>( - link.target()), + HashFunction::Instance(), link.target()), .type = ObjectType::Symlink}); } catch (...) { return false; |