summaryrefslogtreecommitdiff
path: root/src/buildtool/build_engine/target_map/utils.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-05-06 14:31:02 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-05-09 14:55:40 +0200
commit39714825086c40c43345379c95f181a1957d6080 (patch)
tree699300769e26a28330a1d736e0abf4903150fcee /src/buildtool/build_engine/target_map/utils.cpp
parenteb1665fa084772cc4774019fc5a75dc6ddeac143 (diff)
downloadjustbuild-39714825086c40c43345379c95f181a1957d6080.tar.gz
Move path normalisation to a separate library
... as it will be required outside the target map.
Diffstat (limited to 'src/buildtool/build_engine/target_map/utils.cpp')
-rw-r--r--src/buildtool/build_engine/target_map/utils.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/buildtool/build_engine/target_map/utils.cpp b/src/buildtool/build_engine/target_map/utils.cpp
index bff5d1b8..2368f03e 100644
--- a/src/buildtool/build_engine/target_map/utils.cpp
+++ b/src/buildtool/build_engine/target_map/utils.cpp
@@ -4,6 +4,8 @@
#include <filesystem>
#include <vector>
+#include "src/utils/cpp/path.hpp"
+
auto BuildMaps::Target::Utils::obtainTargetByName(
const SubExprEvaluator& eval,
const ExpressionPtr& expr,
@@ -73,28 +75,19 @@ auto BuildMaps::Target::Utils::keys_expr(const ExpressionPtr& map)
return ExpressionPtr{result};
}
-auto BuildMaps::Target::Utils::normal(std::filesystem::path const& p)
- -> std::filesystem::path {
- auto n = p.lexically_normal();
- if (not n.has_filename()) {
- return n.parent_path();
- }
- return n;
-}
-
auto BuildMaps::Target::Utils::tree_conflict(const ExpressionPtr& map)
-> std::optional<std::string> {
std::vector<std::filesystem::path> trees{};
for (auto const& [path, artifact] : map->Map()) {
if (artifact->Artifact().IsTree()) {
- trees.emplace_back(normal(std::filesystem::path{path}));
+ trees.emplace_back(ToNormalPath(std::filesystem::path{path}));
}
}
if (trees.empty()) {
return std::nullopt;
}
for (auto const& [path, artifact] : map->Map()) {
- auto p = normal(std::filesystem::path{path});
+ auto p = ToNormalPath(std::filesystem::path{path});
for (auto const& treepath : trees) {
if (not artifact->Artifact().IsTree()) {
if (std::mismatch(treepath.begin(), treepath.end(), p.begin())