diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-07-04 16:09:57 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-07-05 17:25:03 +0200 |
commit | 452b8664e40fd30a274393f4d97ccdedef8c4e15 (patch) | |
tree | d856618349f4f670a484c1b71ed3ac096cb11827 | |
parent | 65eee628e299b52637941e4e3fdc5fb3168d134e (diff) | |
download | justbuild-452b8664e40fd30a274393f4d97ccdedef8c4e15.tar.gz |
ResultMapTargetMap: support looking up an action by identifier
-rw-r--r-- | src/buildtool/build_engine/target_map/result_map.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp index 173f59d9..ca55ee74 100644 --- a/src/buildtool/build_engine/target_map/result_map.hpp +++ b/src/buildtool/build_engine/target_map/result_map.hpp @@ -4,6 +4,7 @@ #include <algorithm> #include <fstream> #include <mutex> +#include <optional> #include <string> #include <thread> #include <vector> @@ -109,6 +110,20 @@ class ResultTargetMap { }); } + [[nodiscard]] auto GetAction(const ActionIdentifier& identifier) + -> std::optional<ActionDescription::Ptr> { + for (const auto& target : targets_) { + for (const auto& el : target) { + for (const auto& action : el.second->Actions()) { + if (action->Id() == identifier) { + return action; + } + } + } + } + return std::nullopt; + } + template <bool kIncludeOrigins = false> [[nodiscard]] auto ToResult() const -> ResultType<kIncludeOrigins> { ResultType<kIncludeOrigins> result{}; |