From 6c456dbbd4e5aa7e54f3c51fbf7f45ea98d4abd2 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 16 Jan 2024 10:57:35 +0100 Subject: TargetCacheEntry: return implied targets, if serialized --- src/buildtool/storage/target_cache_entry.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/buildtool/storage/target_cache_entry.cpp') diff --git a/src/buildtool/storage/target_cache_entry.cpp b/src/buildtool/storage/target_cache_entry.cpp index e06d0caa..002b3465 100644 --- a/src/buildtool/storage/target_cache_entry.cpp +++ b/src/buildtool/storage/target_cache_entry.cpp @@ -45,6 +45,22 @@ auto TargetCacheEntry::ToResult() const noexcept return TargetResult::FromJson(desc_); } +auto TargetCacheEntry::ToImplied() const noexcept -> std::set { + std::set result{}; + if (desc_.contains("implied export targets")) { + try { + for (auto const& x : desc_["implied export targets"]) { + result.emplace(x); + } + } catch (std::exception const& ex) { + Logger::Log(LogLevel::Warning, + "Exception reading implied export targets: {}", + ex.what()); + } + } + return result; +} + [[nodiscard]] auto ToObjectInfo(nlohmann::json const& json) -> Artifact::ObjectInfo { auto const& desc = ArtifactDescription::FromJson(json); -- cgit v1.2.3