diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-03-22 18:32:23 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-03-22 18:32:23 +0100 |
commit | c3e76101024f40cde137774078f76ce6ea056fcf (patch) | |
tree | b260c2fc5a975760e4abac4925618a6266f3624c | |
parent | a9f66b1355fa45cff1ce3501f1c86f7fcca84092 (diff) | |
download | justbuild-c3e76101024f40cde137774078f76ce6ea056fcf.tar.gz |
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.
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bazel_api.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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<bazel_re::Digest> file_digests{}; + std::vector<std::size_t> 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)) { |