From 981f44d47463ebbc3502494ad2f49173785d632b Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 19 Dec 2024 11:48:54 +0100 Subject: TreeStructure: support parsing in just-mr --- src/other_tools/utils/parse_precomputed_root.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/other_tools/utils/parse_precomputed_root.cpp') diff --git a/src/other_tools/utils/parse_precomputed_root.cpp b/src/other_tools/utils/parse_precomputed_root.cpp index 0b176450..a27c7989 100644 --- a/src/other_tools/utils/parse_precomputed_root.cpp +++ b/src/other_tools/utils/parse_precomputed_root.cpp @@ -60,6 +60,15 @@ namespace { ? config->ToJson() : nlohmann::json::object()}; } + +[[nodiscard]] auto ParseTreeStructureRoot(ExpressionPtr const& repository) + -> expected { + auto const repo = repository->Get("repo", Expression::none_t{}); + if (not repo.IsNotNull()) { + return unexpected{"Mandatory key \"repo\" is missing"}; + } + return TreeStructureRoot{.repository = repo->String()}; +} } // namespace auto ParsePrecomputedRoot(ExpressionPtr const& repository) @@ -85,6 +94,13 @@ auto ParsePrecomputedRoot(ExpressionPtr const& repository) } return PrecomputedRoot{*std::move(computed)}; } + if (type_marker == TreeStructureRoot::kMarker) { + auto tree_structure = ParseTreeStructureRoot(repository); + if (not tree_structure) { + return unexpected{std::move(tree_structure).error()}; + } + return PrecomputedRoot{*std::move(tree_structure)}; + } return unexpected{ fmt::format("Unknown type {} of precomputed repository", type_marker)}; } -- cgit v1.2.3