diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-19 11:35:25 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-20 11:36:17 +0100 |
commit | 5e2fe74d3e5798ef73b3eef98d84577d881aad9a (patch) | |
tree | 76e0531c07d63cc0a1a55c70d524f6ae8e8bf522 /src/other_tools/just_mr | |
parent | 1e9080be33a18dd672d2cb035a18ba1d1aba0fb6 (diff) | |
download | justbuild-5e2fe74d3e5798ef73b3eef98d84577d881aad9a.tar.gz |
TreeStructure: Unify parsing of precomputed roots in just-mr
Diffstat (limited to 'src/other_tools/just_mr')
-rw-r--r-- | src/other_tools/just_mr/TARGETS | 3 | ||||
-rw-r--r-- | src/other_tools/just_mr/setup_utils.cpp | 16 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/other_tools/just_mr/TARGETS b/src/other_tools/just_mr/TARGETS index b8792067..cca118f4 100644 --- a/src/other_tools/just_mr/TARGETS +++ b/src/other_tools/just_mr/TARGETS @@ -103,9 +103,10 @@ [ "exit_codes" , ["@", "json", "", "json"] , ["src/buildtool/file_system", "file_system_manager"] + , ["src/buildtool/file_system", "precomputed_root"] , ["src/buildtool/logging", "log_level"] , ["src/buildtool/logging", "logging"] - , ["src/other_tools/utils", "parse_computed_root"] + , ["src/other_tools/utils", "parse_precomputed_root"] , ["src/utils/cpp", "expected"] ] } diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index 2ab0ebfa..63f555d8 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -29,10 +29,11 @@ #include "src/buildtool/build_engine/expression/expression.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" +#include "src/buildtool/file_system/precomputed_root.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/other_tools/just_mr/exit_codes.hpp" -#include "src/other_tools/utils/parse_computed_root.hpp" +#include "src/other_tools/utils/parse_precomputed_root.hpp" #include "src/utils/cpp/expected.hpp" namespace { @@ -58,16 +59,14 @@ void WarnUnknownKeys(std::string const& name, ExpressionPtr const& repo_def) { } } -[[nodiscard]] auto GetTargetRepoIfComputed(ExpressionPtr const& repo) +[[nodiscard]] auto GetTargetRepoIfPrecomputed(ExpressionPtr const& repo) -> std::optional<std::string> { if (not repo.IsNotNull() or not repo->IsMap()) { return std::nullopt; } auto const repository = repo->Get("repository", Expression::none_t{}); - if (auto const crparser = ComputedRootParser::Create(&repository)) { - if (auto target_repo = crparser->GetTargetRepository()) { - return std::move(target_repo).value(); - } + if (auto const precomputed = ParsePrecomputedRoot(repository)) { + return precomputed->GetReferencedRepository(); } return std::nullopt; } @@ -101,7 +100,8 @@ void ReachableRepositories( WarnUnknownKeys(repo_name, repos_repo_name); // If the current repo is a computed one, process its target repo - if (auto computed_target = GetTargetRepoIfComputed(repos_repo_name)) { + if (auto computed_target = + GetTargetRepoIfPrecomputed(repos_repo_name)) { to_process.push(*std::move(computed_target)); } @@ -125,7 +125,7 @@ void ReachableRepositories( // If the overlay repo is a computed one, process its target // repo - if (auto computed_target = GetTargetRepoIfComputed( + if (auto computed_target = GetTargetRepoIfPrecomputed( repos->Get(layer_repo_name, Expression::none_t{}))) { to_process.push(*std::move(computed_target)); } |