From 70393c8717c7b3b192928e652e103f12ff89a483 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 17 Jan 2025 12:51:04 +0100 Subject: serve client: support keep_artifact_root --- src/buildtool/serve_api/remote/serve_api.hpp | 5 +++-- src/buildtool/serve_api/remote/target_client.cpp | 5 ++++- src/buildtool/serve_api/remote/target_client.hpp | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/buildtool/serve_api/remote/serve_api.hpp b/src/buildtool/serve_api/remote/serve_api.hpp index d7fb1c9a..64cef24c 100644 --- a/src/buildtool/serve_api/remote/serve_api.hpp +++ b/src/buildtool/serve_api/remote/serve_api.hpp @@ -145,9 +145,10 @@ class ServeApi final { } [[nodiscard]] auto ServeTarget(const TargetCacheKey& key, - const ArtifactDigest& repo_key) + const ArtifactDigest& repo_key, + bool keep_artifact_root = false) const noexcept -> std::optional { - return tc_.ServeTarget(key, repo_key); + return tc_.ServeTarget(key, repo_key, keep_artifact_root); } [[nodiscard]] auto CheckServeRemoteExecution() const noexcept -> bool { diff --git a/src/buildtool/serve_api/remote/target_client.cpp b/src/buildtool/serve_api/remote/target_client.cpp index d083b8fc..2490887c 100644 --- a/src/buildtool/serve_api/remote/target_client.cpp +++ b/src/buildtool/serve_api/remote/target_client.cpp @@ -65,7 +65,8 @@ TargetClient::TargetClient( } auto TargetClient::ServeTarget(const TargetCacheKey& key, - const ArtifactDigest& repo_key) const noexcept + const ArtifactDigest& repo_key, + bool keep_artifact_root) const noexcept -> std::optional { // make sure the blob containing the key is in the remote cas if (not apis_.local->RetrieveToCas({key.Id()}, *apis_.remote)) { @@ -90,6 +91,8 @@ auto TargetClient::ServeTarget(const TargetCacheKey& key, *request.mutable_target_cache_key_id() = ArtifactDigestFactory::ToBazel(key.Id().digest); + request.set_keep_artifact_root(keep_artifact_root); + // add execution properties to request for (auto const& [k, v] : exec_config_.platform_properties) { auto* prop = request.add_execution_properties(); diff --git a/src/buildtool/serve_api/remote/target_client.hpp b/src/buildtool/serve_api/remote/target_client.hpp index 21059f2a..0a30a756 100644 --- a/src/buildtool/serve_api/remote/target_client.hpp +++ b/src/buildtool/serve_api/remote/target_client.hpp @@ -67,7 +67,8 @@ class TargetClient { /// \returns A correspondingly populated result union, or nullopt if remote /// reported that the target was not found. [[nodiscard]] auto ServeTarget(const TargetCacheKey& key, - const ArtifactDigest& repo_key) + const ArtifactDigest& repo_key, + bool keep_artifact_root = false) const noexcept -> std::optional; /// \brief Retrieve the flexible config variables of an export target. -- cgit v1.2.3