summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-05-27 14:51:06 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-06-04 14:34:44 +0200
commit82cae74799e5a64c819556f6152ba3734f1e2035 (patch)
tree4b557f7ebf139f7735a201f20d08a62f282add4d /src
parent2174d33a0093240502720832fe11b690c53443d9 (diff)
downloadjustbuild-82cae74799e5a64c819556f6152ba3734f1e2035.tar.gz
{Local,Bazel}Response: Fix logic for marking succesful population
While in practice a failure to populate the fields of a response happens once per invocation, as it will trigger a failure of the execution, from an algorithmic standpoint the flag to mark a successful population of the response fields should only be set on actual success. Fix this.
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_api/local/local_response.hpp2
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_response.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp
index 852284b7..790bb384 100644
--- a/src/buildtool/execution_api/local/local_response.hpp
+++ b/src/buildtool/execution_api/local/local_response.hpp
@@ -144,7 +144,6 @@ class LocalResponse final : public IExecutionResponse {
if (populated_) {
return std::nullopt;
}
- populated_ = true;
ArtifactInfos artifacts{};
auto const& action_result = output_.action;
@@ -276,6 +275,7 @@ class LocalResponse final : public IExecutionResponse {
}
artifacts_ = std::move(artifacts);
dir_symlinks_ = std::move(dir_symlinks);
+ populated_ = true;
return std::nullopt;
}
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
index cedc1ff4..81392813 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
@@ -97,7 +97,6 @@ auto BazelResponse::Populate() noexcept -> std::optional<std::string> {
if (populated_) {
return std::nullopt;
}
- populated_ = true;
ArtifactInfos artifacts{};
auto const& action_result = output_.action_result;
@@ -215,6 +214,7 @@ auto BazelResponse::Populate() noexcept -> std::optional<std::string> {
}
artifacts_ = std::move(artifacts);
dir_symlinks_ = std::move(dir_symlinks);
+ populated_ = true;
return std::nullopt;
}
@@ -272,6 +272,7 @@ auto BazelResponse::Populate() noexcept -> std::optional<std::string> {
}
artifacts_ = std::move(artifacts);
dir_symlinks_ = std::move(dir_symlinks);
+ populated_ = true;
return std::nullopt;
}