diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-03-16 16:21:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-03-16 16:21:07 +0200 |
commit | 7f9fda79a0e96bbeeaee4e6b05f9ae5e1738d88a (patch) | |
tree | 7a5594759f62f9136db32845fd4baf7268805d7a | |
parent | c76ff457079bf5901a6bb55377c14aeee856a354 (diff) |
Change prerequisite cleaning "limit" from subdirectories to same project
One day we will get this right.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | build2/algorithm.ixx | 8 | ||||
-rw-r--r-- | build2/cxx/compile.cxx | 7 | ||||
-rw-r--r-- | build2/cxx/link.cxx | 8 |
4 files changed, 15 insertions, 10 deletions
@@ -64,7 +64,7 @@ Version 0.3.0 dependency (.d) files rather than being re-extracted on every run. This speeds up the up-to-date check significantly. - * Revert back to only cleaning targets in subdirectories. + * Revert back to only cleaning prerequisites if they are in the same project. Cleaning everything as long as it is in the same strong amalgamation had some undesirable side effects. For example, in bpkg, upgrading a package diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index a405c30..3f0bab9 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -101,7 +101,11 @@ namespace build2 search_and_match_prerequisites (action a, target& t) { search_and_match_prerequisites ( - a, t, a.operation () != clean_id ? dir_path () : t.dir); + a, + t, + (a.operation () != clean_id + ? dir_path () + : t.root_scope ().out_path ())); } inline void @@ -114,7 +118,7 @@ namespace build2 // through groups since the group target should clean eveything // up. A bit of an optimization. // - search_and_match_prerequisites (a, t, t.dir); + search_and_match_prerequisites (a, t, t.root_scope ().out_path ()); } target_state diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx index b07019d..df2b798 100644 --- a/build2/cxx/compile.cxx +++ b/build2/cxx/compile.cxx @@ -81,8 +81,10 @@ namespace build2 // code (below) takes care of the ones it is adding. // // When cleaning, ignore prerequisites that are not in the same - // or a subdirectory of ours. + // or a subdirectory of our project root. // + scope& rs (t.root_scope ()); + link::search_paths_cache lib_paths; // Extract lazily. for (prerequisite_member p: group_prerequisite_members (a, t)) @@ -115,7 +117,7 @@ namespace build2 target& pt (p.search ()); - if (a.operation () == clean_id && !pt.dir.sub (t.dir)) + if (a.operation () == clean_id && !pt.dir.sub (rs.out_path ())) continue; build2::match (a, pt); @@ -128,7 +130,6 @@ namespace build2 // if (a == perform_update_id) { - scope& rs (t.root_scope ()); const string& sys (as<string> (*rs["cxx.target.system"])); // The cached prerequisite target should be the same as what is in diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx index f9fa69d..5ed36b7 100644 --- a/build2/cxx/link.cxx +++ b/build2/cxx/link.cxx @@ -543,7 +543,7 @@ namespace build2 // files as well as search and match. // // When cleaning, ignore prerequisites that are not in the same - // or a subdirectory of ours. + // or a subdirectory of our project root. // for (prerequisite_member p: group_prerequisite_members (a, t)) { @@ -562,7 +562,7 @@ namespace build2 if (pt == nullptr) pt = &p.search (); - if (a.operation () == clean_id && !pt->dir.sub (t.dir)) + if (a.operation () == clean_id && !pt->dir.sub (rs.out_path ())) continue; // Skip. // If this is the obj{} or lib{} target group, then pick the @@ -624,9 +624,9 @@ namespace build2 target& ot (search (o_type, d, *cp.tk.name, nullptr, cp.scope)); // If we are cleaning, check that this target is in the same or - // a subdirectory of ours. + // a subdirectory of our project root. // - if (a.operation () == clean_id && !ot.dir.sub (t.dir)) + if (a.operation () == clean_id && !ot.dir.sub (rs.out_path ())) { // If we shouldn't clean obj{}, then it is fair to assume // we shouldn't clean cxx{} either (generated source will |