diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-07-14 13:41:31 +0200 |
---|---|---|
committer | Sascha Roloff <sascha.roloff@huawei.com> | 2022-08-05 14:41:31 +0200 |
commit | 087d73496115c2a04d5cd40b6b0205f0562f81dc (patch) | |
tree | 5a3bad002fbcee485a6e9affbe8d5c356e404f63 /src | |
parent | daca274041e31636f08927b0cebc56fd33c7bbdf (diff) | |
download | justbuild-087d73496115c2a04d5cd40b6b0205f0562f81dc.tar.gz |
BazelResponse: Support collecting output dirs in native mode
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/remote/TARGETS | 1 | ||||
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bazel_response.cpp | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/remote/TARGETS b/src/buildtool/execution_api/remote/TARGETS index b05404ed..492bd0de 100644 --- a/src/buildtool/execution_api/remote/TARGETS +++ b/src/buildtool/execution_api/remote/TARGETS @@ -24,6 +24,7 @@ , ["src/buildtool/logging", "logging"] , ["src/buildtool/file_system", "file_system_manager"] , ["src/buildtool/file_system", "object_type"] + , ["src/buildtool/compatibility", "compatibility"] , ["src/buildtool/execution_api/common", "common"] , ["src/buildtool/execution_api/bazel_msg", "bazel_msg_factory"] , ["@", "grpc", "", "grpc++"] 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<bazel_re::Digest> tree_digests{}; tree_digests.reserve( |