summaryrefslogtreecommitdiff
path: root/src/buildtool/storage/target_cache_entry.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-01-16 16:57:16 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-01-16 18:59:41 +0100
commit665b1b04f255ef27403d67d4a4ca8582c179307b (patch)
tree919f9d67f65b6e44f499ab1390aa12d810a65f45 /src/buildtool/storage/target_cache_entry.cpp
parentfb365b17ca339a25688ff61918280a46d64943b9 (diff)
downloadjustbuild-665b1b04f255ef27403d67d4a4ca8582c179307b.tar.gz
TargetCacheEntry: serialize implied export targets
Diffstat (limited to 'src/buildtool/storage/target_cache_entry.cpp')
-rw-r--r--src/buildtool/storage/target_cache_entry.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/buildtool/storage/target_cache_entry.cpp b/src/buildtool/storage/target_cache_entry.cpp
index 002b3465..2f245624 100644
--- a/src/buildtool/storage/target_cache_entry.cpp
+++ b/src/buildtool/storage/target_cache_entry.cpp
@@ -17,6 +17,8 @@
#include <algorithm>
#include <exception>
#include <iterator>
+#include <string>
+#include <vector>
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
@@ -29,10 +31,18 @@ auto TargetCacheEntry::FromTarget(
auto result = TargetResult{.artifact_stage = target->Artifacts(),
.provides = target->Provides(),
.runfiles = target->RunFiles()};
- if (auto desc = result.ReplaceNonKnownAndToJson(replacements)) {
- return TargetCacheEntry{*desc};
+ auto desc = result.ReplaceNonKnownAndToJson(replacements);
+ if (not desc) {
+ return std::nullopt;
}
- return std::nullopt;
+ std::vector<std::string> implied{};
+ for (auto const& x : target->ImpliedExport()) {
+ implied.emplace_back(x);
+ }
+ if (not implied.empty()) {
+ (*desc)["implied export targets"] = implied;
+ }
+ return TargetCacheEntry{*desc};
}
auto TargetCacheEntry::FromJson(nlohmann::json desc) noexcept