diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-10-26 12:33:34 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-10-26 12:37:28 +0200 |
commit | d3b4636ca3f4c3ad98c8096326c5b1460d05691d (patch) | |
tree | 8d3e8564cd8019f8ea94b31fbff21ce747ef23cd /libbuild2/rule.cxx | |
parent | a3d5de5dfecc694d15f23ed03d13cb108dda3e1b (diff) |
Add inject_fsdir_direct(), fsdir_rule::perform_clean_direct() functions
Diffstat (limited to 'libbuild2/rule.cxx')
-rw-r--r-- | libbuild2/rule.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index 0d6ec8c..13dd467 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -366,6 +366,8 @@ namespace build2 // Don't fail if we couldn't remove the directory because it is not empty // (or is current working directory). In this case rmdir() will issue a // warning when appropriate. + + // The same code as in perform_clean_direct() below. // target_state ts (rmdir (t.dir, t, t.ctx.current_diag_noise ? 1 : 2) ? target_state::changed @@ -377,6 +379,23 @@ namespace build2 return ts; } + void fsdir_rule:: + perform_clean_direct (action a, const target& t) + { + // The same code as in perform_clean() above. + // + rmdir (t.dir, t, t.ctx.current_diag_noise ? 1 : 2); + + // Then clean the parent directory. If present, it is always first. + // + const target* p (t.prerequisite_targets[a].empty () + ? nullptr + : t.prerequisite_targets[a][0]); + + if (p != nullptr && p->is_a<fsdir> ()) + perform_clean_direct (a, *p); + } + const fsdir_rule fsdir_rule::instance; // noop_rule |