From 087d73496115c2a04d5cd40b6b0205f0562f81dc Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Thu, 14 Jul 2022 13:41:31 +0200 Subject: BazelResponse: Support collecting output dirs in native mode --- .../execution_api/remote/bazel/bazel_response.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.cpp') diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp index 2dbb7653..395fd08e 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp @@ -1,6 +1,7 @@ #include "src/buildtool/execution_api/remote/bazel/bazel_response.hpp" #include "gsl-lite/gsl-lite.hpp" +#include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp" #include "src/buildtool/logging/logger.hpp" @@ -34,6 +35,22 @@ auto BazelResponse::Artifacts() const noexcept -> ArtifactInfos { } } + if (not Compatibility::IsCompatible()) { + // in native mode: just collect and store tree digests + for (auto const& tree : action_result.output_directories()) { + gsl_ExpectsAudit(NativeSupport::IsTree(tree.tree_digest().hash())); + try { + artifacts.emplace( + tree.path(), + Artifact::ObjectInfo{ArtifactDigest{tree.tree_digest()}, + ObjectType::Tree}); + } catch (...) { + return {}; + } + } + return artifacts; + } + // obtain tree digests for output directories std::vector tree_digests{}; tree_digests.reserve( -- cgit v1.2.3