summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr/utils.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2022-09-09 10:46:47 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2022-12-21 14:59:04 +0100
commit1f4edf773b98ad04cc24f281b8cfb64255f72fb1 (patch)
treea2a0c01660c78fe3e73dc5697a0e70ec69a0d161 /src/other_tools/just_mr/utils.hpp
parent7c6e2fa5f90259a331b24d9b4f17ce195086af8b (diff)
downloadjustbuild-1f4edf773b98ad04cc24f281b8cfb64255f72fb1.tar.gz
Just-MR: Add repos-to-setup map
Contains the logic for the checkout of all supported repositories.
Diffstat (limited to 'src/other_tools/just_mr/utils.hpp')
-rw-r--r--src/other_tools/just_mr/utils.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/utils.hpp b/src/other_tools/just_mr/utils.hpp
index 2da0155a..dffed7c1 100644
--- a/src/other_tools/just_mr/utils.hpp
+++ b/src/other_tools/just_mr/utils.hpp
@@ -18,6 +18,7 @@
#include <unordered_set>
#include "nlohmann/json.hpp"
+#include "src/buildtool/build_engine/expression/configuration.hpp"
#include "src/buildtool/execution_api/local/config.hpp"
#include "src/buildtool/main/constants.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
@@ -152,6 +153,21 @@ namespace Utils {
void AddDistfileToCAS(std::filesystem::path const& distfile,
JustMR::PathsPtr const& just_mr_paths) noexcept;
+/// \brief Recursive part of the ResolveRepo function.
+/// Keeps track of repository names to detect any cyclic dependencies.
+auto ResolveRepo(ExpressionPtr const& repo_desc,
+ ExpressionPtr const& repos,
+ gsl::not_null<std::unordered_set<std::string>*> const& seen)
+ -> std::optional<ExpressionPtr>;
+
+/// \brief Resolves any cyclic dependency issues and follows the repository
+/// dependencies until the one containing the WS root is found.
+/// Returns a repository entry as an ExpressionPtr, or nullopt if cyclic
+/// dependency found.
+auto ResolveRepo(ExpressionPtr const& repo_desc,
+ ExpressionPtr const& repos) noexcept
+ -> std::optional<ExpressionPtr>;
+
} // namespace Utils
} // namespace JustMR