diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2025-06-23 14:56:04 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2025-06-24 14:56:58 +0200 |
commit | bbcc5977f49646941ac35060bb74a27eda5fbd76 (patch) | |
tree | 4e11ded4722ea740fbeea12510efd34fe698c04b /src/buildtool/execution_api/utils | |
parent | c498bf564fa5d781c176f65c7a9a2d43376a81f1 (diff) | |
download | justbuild-bbcc5977f49646941ac35060bb74a27eda5fbd76.tar.gz |
ExecutionAPI: Support output_paths in requests
... and prepare local execution for clients
using only RBEv2.1 (setting only output_paths).
Diffstat (limited to 'src/buildtool/execution_api/utils')
-rw-r--r-- | src/buildtool/execution_api/utils/outputscheck.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/utils/outputscheck.hpp b/src/buildtool/execution_api/utils/outputscheck.hpp index da20ee90..026fce35 100644 --- a/src/buildtool/execution_api/utils/outputscheck.hpp +++ b/src/buildtool/execution_api/utils/outputscheck.hpp @@ -62,6 +62,34 @@ } } +// overload for treating file and directory paths alike +[[nodiscard]] static inline auto ActionResultContainsExpectedOutputs( + const bazel_re::ActionResult& result, + const std::vector<std::string>& expected_paths) noexcept -> bool { + try { + std::set<std::string> actual_output_paths{}; + for (auto const& file : result.output_files()) { + actual_output_paths.emplace(file.path()); + } + for (auto const& file : result.output_file_symlinks()) { + actual_output_paths.emplace(file.path()); + } + for (auto const& file : result.output_directory_symlinks()) { + actual_output_paths.emplace(file.path()); + } + for (auto const& dir : result.output_directories()) { + actual_output_paths.emplace(dir.path()); + } + return std::all_of(expected_paths.begin(), + expected_paths.end(), + [&actual_output_paths](auto const& expected) { + return actual_output_paths.contains(expected); + }); + } catch (...) { + return false; + } +} + #endif #endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_UTILS_OUTPUTSCHECK_HPP |