summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-07-09 16:46:47 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-07-22 17:01:13 +0200
commit792751a72f86360afd12158e9eedc00e88db13a6 (patch)
tree15c6332efed6e044c6ba07877302bab898c37b06 /src
parentf94b4663dc61a2987912faa3f1cd71378db0ad33 (diff)
downloadjustbuild-792751a72f86360afd12158e9eedc00e88db13a6.tar.gz
Pass HashFunction to CreateActionDigestFromCommandLine
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_api/bazel_msg/TARGETS2
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp5
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp4
-rw-r--r--src/buildtool/execution_api/local/local_action.hpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_action.cpp1
5 files changed, 10 insertions, 4 deletions
diff --git a/src/buildtool/execution_api/bazel_msg/TARGETS b/src/buildtool/execution_api/bazel_msg/TARGETS
index db495aa5..ddb40899 100644
--- a/src/buildtool/execution_api/bazel_msg/TARGETS
+++ b/src/buildtool/execution_api/bazel_msg/TARGETS
@@ -29,12 +29,12 @@
, ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
, ["@", "gsl", "", "gsl"]
+ , ["src/buildtool/crypto", "hash_function"]
]
, "private-deps":
[ ["src/buildtool/compatibility", "compatibility"]
, ["src/utils/cpp", "hex_string"]
, ["src/buildtool/file_system", "file_system_manager"]
- , ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/file_system", "git_repo"]
]
, "stage": ["src", "buildtool", "execution_api", "bazel_msg"]
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 52002c47..aeb75540 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
@@ -27,7 +27,6 @@
#include "src/buildtool/common/bazel_types.hpp"
#include "src/buildtool/compatibility/native_support.hpp"
-#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/git_repo.hpp"
#include "src/utils/cpp/hex_string.hpp"
@@ -229,7 +228,7 @@ template <class T>
return std::nullopt;
}
auto digest = ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), *content);
+ request.hash_function, *content);
return BazelBlob{digest, std::move(*content), /*is_exec=*/false};
}
@@ -266,7 +265,7 @@ template <class T>
return std::nullopt;
}
auto digest = ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), *content);
+ request.hash_function, *content);
return BazelBlob{digest, std::move(*content), /*is_exec=*/false};
}
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 e8dc6da0..c48e605d 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp
@@ -27,6 +27,7 @@
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/common/bazel_types.hpp"
+#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_common.hpp"
#include "src/buildtool/execution_api/bazel_msg/directory_tree.hpp"
@@ -158,6 +159,9 @@ struct BazelMsgFactory::ActionDigestRequest final {
/// \brief The Digest of the execution directory.
gsl::not_null<bazel_re::Digest const*> const exec_dir;
+ /// \brief Hash function to be used.
+ HashFunction const hash_function;
+
/// \brief The command execution timeout.
std::chrono::milliseconds const timeout;
diff --git a/src/buildtool/execution_api/local/local_action.hpp b/src/buildtool/execution_api/local/local_action.hpp
index a9ffe959..4e377c39 100644
--- a/src/buildtool/execution_api/local/local_action.hpp
+++ b/src/buildtool/execution_api/local/local_action.hpp
@@ -25,6 +25,7 @@
#include <vector>
#include "gsl/gsl"
+#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp"
#include "src/buildtool/execution_api/common/execution_action.hpp"
#include "src/buildtool/execution_api/common/execution_response.hpp"
@@ -113,6 +114,7 @@ class LocalAction final : public IExecutionAction {
.env_vars = &env_vars,
.properties = &properties_,
.exec_dir = &exec_dir,
+ .hash_function = HashFunction::Instance(),
.timeout = timeout_,
.skip_action_cache = do_not_cache};
return BazelMsgFactory::CreateActionDigestFromCommandLine(request);
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
index c6cadf20..4190ea19 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
@@ -127,6 +127,7 @@ auto BazelAction::CreateBundlesForAction(BazelBlobContainer* blobs,
.env_vars = &env_vars_,
.properties = &properties_,
.exec_dir = &exec_dir,
+ .hash_function = network_->GetHashFunction(),
.timeout = timeout_,
.skip_action_cache = do_not_cache,
.store_blob = std::move(store_blob)};