summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-07-09 16:30:53 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-07-22 17:01:13 +0200
commit96b4474027c9dba57bb943d84e67be402175ccc8 (patch)
tree2cc4510a9f021b093260c9cc084cf42a1011db3b
parent4368bf026fa7d18d2c01ac18cdb3e9ff6a228221 (diff)
downloadjustbuild-96b4474027c9dba57bb943d84e67be402175ccc8.tar.gz
Use a fixed HashFunction in CreateDirectoryDigestFromTree
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp7
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp5
2 files changed, 8 insertions, 4 deletions
diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
index 155067fd..52002c47 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
@@ -185,8 +185,11 @@ template <class T>
if (not content) {
return std::nullopt;
}
- auto digest = ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), *content);
+
+ // SHA256 is used since bazel types are processed here.
+ HashFunction const hash_function{HashFunction::JustHash::Compatible};
+ auto digest =
+ ArtifactDigest::Create<ObjectType::File>(hash_function, *content);
auto msg = CreateDirectoryNode(dir_name);
msg.set_allocated_digest(
diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp
index 720d00d5..e8dc6da0 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp
@@ -51,8 +51,9 @@ class BazelMsgFactory {
using TreeStoreFunc =
std::function<std::optional<bazel_re::Digest>(std::string const&)>;
- /// \brief Create Directory digest from artifact tree structure.
- /// Recursively traverse entire tree and create blobs for sub-directories.
+ /// \brief Create Directory digest from artifact tree structure. Uses
+ /// compatible HashFunction for hashing. Recursively traverse entire tree
+ /// and create blobs for sub-directories.
/// \param tree Directory tree of artifacts.
/// \param resolve_links Function for resolving symlinks.
/// \param process_blob Function for processing Directory blobs.