diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-04-19 10:51:23 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-04-19 10:55:21 +0200 |
commit | 9de5184cc650acb2ee6573b81fa8f38c729c8394 (patch) | |
tree | adc69e7b21da7fcec2c12e8b179bf9f986e678fb /src | |
parent | 5d86168a57564d77dd16a0e342d5ba8adb8f2650 (diff) | |
download | justbuild-9de5184cc650acb2ee6573b81fa8f38c729c8394.tar.gz |
Conflict checking: use normalized paths
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/build_engine/target_map/utils.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/buildtool/build_engine/target_map/utils.cpp b/src/buildtool/build_engine/target_map/utils.cpp index e84634da..5d80b4c7 100644 --- a/src/buildtool/build_engine/target_map/utils.cpp +++ b/src/buildtool/build_engine/target_map/utils.cpp @@ -73,19 +73,31 @@ auto BuildMaps::Target::Utils::keys_expr(const ExpressionPtr& map) return ExpressionPtr{result}; } +namespace { + +auto 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; +} + +} // namespace + 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(std::filesystem::path{path}); + trees.emplace_back(normal(std::filesystem::path{path})); } } if (trees.empty()) { return std::nullopt; } for (auto const& [path, artifact] : map->Map()) { - auto p = std::filesystem::path{path}; + auto p = normal(std::filesystem::path{path}); for (auto const& treepath : trees) { if (not artifact->Artifact().IsTree()) { if (std::mismatch(treepath.begin(), treepath.end(), p.begin()) |