summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSascha Roloff <sascha.roloff@huawei.com>2023-06-27 19:41:12 +0200
committerSascha Roloff <sascha.roloff@huawei.com>2023-06-28 15:59:26 +0200
commit21481c72129ba81c3f22c531b45945924f9c780c (patch)
tree44bc729c03abc9c7d64e7b1781977aadc37b3e1c /src
parent3f864eaf19b397d0b8a18feb0687178729a573a2 (diff)
downloadjustbuild-21481c72129ba81c3f22c531b45945924f9c780c.tar.gz
Update remote execution api to preliminary version v2.3
In preparation for the introduction of our blob splitting protocol as extension to the remote execution api, we need to update the used remote execution api to a more recent version than v2.0.0. Since no new tags are available right now, we update to the preliminary protocol version v2.3 according to the following discussion: https://github.com/bazelbuild/remote-apis/issues/253
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp31
-rw-r--r--src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp1
-rw-r--r--src/buildtool/execution_api/execution_service/capabilities_server.cpp2
-rw-r--r--src/buildtool/execution_api/local/local_action.hpp1
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_action.cpp1
5 files changed, 21 insertions, 15 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 12f7398f..9104b94d 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp
@@ -211,9 +211,10 @@ template <class T>
copy_nodes(dir.mutable_directories(), dirs);
copy_nodes(dir.mutable_symlinks(), links);
- std::copy(props.cbegin(),
- props.cend(),
- pb::back_inserter(dir.mutable_node_properties()));
+ std::copy(
+ props.cbegin(),
+ props.cend(),
+ pb::back_inserter(dir.mutable_node_properties()->mutable_properties()));
return dir;
}
@@ -229,7 +230,8 @@ template <class T>
node.set_is_executable(IsExecutableObject(type));
std::copy(props.cbegin(),
props.cend(),
- pb::back_inserter(node.mutable_node_properties()));
+ pb::back_inserter(
+ node.mutable_node_properties()->mutable_properties()));
return node;
}
@@ -252,7 +254,8 @@ template <class T>
node.set_target(target);
std::copy(props.cbegin(),
props.cend(),
- pb::back_inserter(node.mutable_node_properties()));
+ pb::back_inserter(
+ node.mutable_node_properties()->mutable_properties()));
return node;
}
@@ -322,6 +325,10 @@ template <class T>
std::vector<bazel_re::Platform_Property> const& platform_properties)
-> CommandBundle::Ptr {
bazel_re::Command msg;
+ // DEPRECATED as of v2.2: platform properties are now specified
+ // directly in the action. See documentation note in the
+ // [Action][build.bazel.remote.execution.v2.Action] for migration.
+ // (https://github.com/bazelbuild/remote-apis/blob/e1fe21be4c9ae76269a5a63215bb3c72ed9ab3f0/build/bazel/remote/execution/v2/remote_execution.proto#L646)
msg.set_allocated_platform(CreatePlatform(platform_properties).release());
std::copy(std::cbegin(args),
std::cend(args),
@@ -349,7 +356,7 @@ template <class T>
[[nodiscard]] auto CreateActionBundle(
bazel_re::Digest const& command,
bazel_re::Digest const& root_dir,
- std::vector<std::string> const& output_node_properties,
+ std::vector<bazel_re::Platform_Property> const& platform_properties,
bool do_not_cache,
std::chrono::milliseconds const& timeout) -> ActionBundle::Ptr {
using seconds = std::chrono::seconds;
@@ -368,9 +375,12 @@ template <class T>
gsl::owner<bazel_re::Digest*>{new bazel_re::Digest{command}});
msg.set_allocated_input_root_digest(
gsl::owner<bazel_re::Digest*>{new bazel_re::Digest{root_dir}});
- std::copy(output_node_properties.cbegin(),
- output_node_properties.cend(),
- pb::back_inserter(msg.mutable_output_node_properties()));
+ // New in version 2.2: clients SHOULD set these platform properties
+ // as well as those in the
+ // [Command][build.bazel.remote.execution.v2.Command]. Servers
+ // SHOULD prefer those set here.
+ // (https://github.com/bazelbuild/remote-apis/blob/e1fe21be4c9ae76269a5a63215bb3c72ed9ab3f0/build/bazel/remote/execution/v2/remote_execution.proto#L516)
+ msg.set_allocated_platform(CreatePlatform(platform_properties).release());
auto content_creator = [&msg] { return SerializeMessage(msg); };
@@ -728,7 +738,6 @@ auto BazelMsgFactory::CreateActionDigestFromCommandLine(
bazel_re::Digest const& exec_dir,
std::vector<std::string> const& output_files,
std::vector<std::string> const& output_dirs,
- std::vector<std::string> const& output_node_properties,
std::vector<bazel_re::Command_EnvironmentVariable> const& env_vars,
std::vector<bazel_re::Platform_Property> const& properties,
bool do_not_cache,
@@ -740,7 +749,7 @@ auto BazelMsgFactory::CreateActionDigestFromCommandLine(
// create action
auto action = CreateActionBundle(
- cmd->Digest(), exec_dir, output_node_properties, do_not_cache, timeout);
+ cmd->Digest(), exec_dir, properties, do_not_cache, timeout);
if (store_blob) {
(*store_blob)(cmd->MakeBlob(/*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 ca913c63..f27f246f 100644
--- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp
+++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp
@@ -127,7 +127,6 @@ class BazelMsgFactory {
bazel_re::Digest const& exec_dir,
std::vector<std::string> const& output_files,
std::vector<std::string> const& output_dirs,
- std::vector<std::string> const& output_node_properties,
std::vector<bazel_re::Command_EnvironmentVariable> const& env_vars,
std::vector<bazel_re::Platform_Property> const& properties,
bool do_not_cache,
diff --git a/src/buildtool/execution_api/execution_service/capabilities_server.cpp b/src/buildtool/execution_api/execution_service/capabilities_server.cpp
index ea480301..35126bd3 100644
--- a/src/buildtool/execution_api/execution_service/capabilities_server.cpp
+++ b/src/buildtool/execution_api/execution_service/capabilities_server.cpp
@@ -30,7 +30,7 @@ auto CapabilitiesServiceImpl::GetCapabilities(
::bazel_re::CacheCapabilities cache;
::bazel_re::ExecutionCapabilities exec;
- cache.add_digest_function(
+ cache.add_digest_functions(
::bazel_re::DigestFunction_Value::DigestFunction_Value_SHA256);
cache.mutable_action_cache_update_capabilities()->set_update_enabled(false);
static constexpr std::size_t kMaxBatchTransferSize = 1024 * 1024;
diff --git a/src/buildtool/execution_api/local/local_action.hpp b/src/buildtool/execution_api/local/local_action.hpp
index 95f95ff4..82101016 100644
--- a/src/buildtool/execution_api/local/local_action.hpp
+++ b/src/buildtool/execution_api/local/local_action.hpp
@@ -91,7 +91,6 @@ class LocalAction final : public IExecutionAction {
exec_dir,
output_files_,
output_dirs_,
- {} /*FIXME output node properties*/,
BazelMsgFactory::CreateMessageVectorFromMap<
bazel_re::Command_EnvironmentVariable>(env_vars_),
properties_,
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
index d7f9f389..04d4c3f7 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp
@@ -91,7 +91,6 @@ auto BazelAction::CreateBundlesForAction(BlobContainer* blobs,
exec_dir,
output_files_,
output_dirs_,
- {} /*FIXME output node properties*/,
env_vars_,
properties_,
do_not_cache,