From c3e76101024f40cde137774078f76ce6ea056fcf Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 22 Mar 2022 18:32:23 +0100 Subject: BazelApi: Fix retrieving artifacts to filesystem path ... which was accessing the wrong artifacts in the list if the artifact list contains a mixture of files and trees. --- src/buildtool/execution_api/remote/bazel/bazel_api.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/buildtool/execution_api/remote/bazel/bazel_api.cpp') diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp index 990d6067..05d9c357 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp @@ -64,6 +64,7 @@ auto BazelApi::CreateAction( // Obtain file digests from artifact infos std::vector file_digests{}; + std::vector artifact_pos{}; for (std::size_t i{}; i < artifacts_info.size(); ++i) { auto const& info = artifacts_info[i]; if (IsTreeObject(info.type)) { @@ -76,6 +77,7 @@ auto BazelApi::CreateAction( } else { file_digests.emplace_back(info.digest); + artifact_pos.emplace_back(i); } } @@ -90,7 +92,7 @@ auto BazelApi::CreateAction( return false; } for (std::size_t pos = 0; pos < blobs.size(); ++pos) { - auto gpos = count + pos; + auto gpos = artifact_pos[count + pos]; auto const& type = artifacts_info[gpos].type; if (not FileSystemManager::WriteFileAs( blobs[pos].data, output_paths[gpos], type)) { -- cgit v1.2.3