diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-05-25 11:19:55 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-05-31 15:21:02 +0200 |
commit | 26e7149fe8cc1be820ab35ebb6b92a683f9809bb (patch) | |
tree | d4cc1bf3cddbd54302e4e8c43af0dfe9fa128d75 /src/buildtool/main/main.cpp | |
parent | 052c762d16885b198989e2de164d37f8a8d19462 (diff) | |
download | justbuild-26e7149fe8cc1be820ab35ebb6b92a683f9809bb.tar.gz |
just: Add handling of ignore-special roots
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r-- | src/buildtool/main/main.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 79c7c0cb..2bfe631b 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -664,6 +664,42 @@ auto ParseRoot(std::string const& repo, root[1]); std::exit(kExitFailure); } + if (root[0] == FileRoot::kFileIgnoreSpecialMarker) { + if (root.size() != 2 or (not root[1].is_string())) { + Logger::Log( + LogLevel::Error, + "\"file ignore-special\" scheme expects precisely one string " + "argument, but found {} for {} of repository {}", + root.dump(), + keyword, + repo); + std::exit(kExitFailure); + } + auto path = std::filesystem::path{root[1]}; + return {FileRoot{path, /*ignore_special=*/true}, std::move(path)}; + } + if (root[0] == FileRoot::kGitTreeIgnoreSpecialMarker) { + if (root.size() != 3 or (not root[1].is_string()) or + (not root[2].is_string())) { + Logger::Log(LogLevel::Error, + "\"git tree ignore-special\" scheme expects two string " + "arguments, but found {} for {} of repository {}", + root.dump(), + keyword, + repo); + std::exit(kExitFailure); + } + if (auto git_root = + FileRoot::FromGit(root[2], root[1], /*ignore_special=*/true)) { + return {std::move(*git_root), std::nullopt}; + } + Logger::Log(LogLevel::Error, + "Could not create file root for git repository {} and tree " + "id {}", + root[2], + root[1]); + std::exit(kExitFailure); + } Logger::Log(LogLevel::Error, "Unknown scheme in the specification {} of {} of repository {}", root.dump(), |