aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-02 13:58:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-02 14:03:55 +0200
commit9fa4b867890dfaa3fa086affec23049826765dfe (patch)
tree4643a3cbdf6ebb057e12cd31fd60a71aeda654a2
parente45345eeee4db91644a58842267393ff2df19fe2 (diff)
Fix clean logic
-rw-r--r--build2/algorithm.cxx24
-rw-r--r--build2/rule.cxx8
2 files changed, 17 insertions, 15 deletions
diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx
index 728fb14..d981af0 100644
--- a/build2/algorithm.cxx
+++ b/build2/algorithm.cxx
@@ -693,22 +693,26 @@ namespace build2
{
tracer trace ("inject_fsdir");
- const scope& bs (t.base_scope ());
+ // If t is a directory (name is empty), say foo/bar/, then t is bar and
+ // its parent directory is foo/.
+ //
+ const dir_path& d (parent && t.name.empty () ? t.dir.directory () : t.dir);
+
+ const scope& bs (scopes.find (d));
const scope* rs (bs.root_scope ());
- // Handle the outside of any project case. Note that we also used to bail
- // our of this is the root of the project. But that proved not to be such
- // a great idea in case of subprojects (e.g., tests/).
+ // If root scope is NULL, then this can mean that we are out of any
+ // project or if the directory is in src_root. In both cases we don't
+ // inject anything.
+ //
+ // Note that we also used to bail out if this is the root of the
+ // project. But that proved not to be such a great idea in case of
+ // subprojects (e.g., tests/).
//
if (rs == nullptr)
return nullptr;
- // If t is a directory (name is empty), say foo/bar/, then t is bar and
- // its parent directory is foo/.
- //
- const dir_path& d (parent && t.name.empty () ? t.dir.directory () : t.dir);
-
- // Handle the src = out.
+ // Handle the src_root = out_root.
//
if (d.sub (rs->src_path ()))
return nullptr;
diff --git a/build2/rule.cxx b/build2/rule.cxx
index dd508d0..53f723b 100644
--- a/build2/rule.cxx
+++ b/build2/rule.cxx
@@ -153,12 +153,10 @@ namespace build2
recipe fsdir_rule::
apply (action a, target& t) const
{
- // Inject dependency on the parent directory. Note that we don't do it for
- // clean since we shouldn't (and can't possibly, since it's our parent) be
- // removing it. It also must be first (see perform_update_direct()).
+ // Inject dependency on the parent directory. Note that it must be first
+ // (see perform_update_direct()).
//
- if (a.operation () != clean_id)
- inject_fsdir (a, t);
+ inject_fsdir (a, t);
match_prerequisites (a, t);