From 4402d5fc6002769210bf06c97f6a3cc97f6e30ee Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 23 Aug 2017 20:07:26 +0200 Subject: Add perform_clean_group(), use instead of ad hoc implementation in cli rule --- build2/algorithm.cxx | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'build2/algorithm.cxx') diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index 174c395..14c1960 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -1425,12 +1425,36 @@ namespace build2 target_state perform_clean (action a, const target& t) { - return clean_extra (a, dynamic_cast (t), {nullptr}); + return clean_extra (a, t.as (), {nullptr}); } target_state perform_clean_depdb (action a, const target& t) { - return clean_extra (a, dynamic_cast (t), {".d"}); + return clean_extra (a, t.as (), {".d"}); + } + + target_state + perform_clean_group (action a, const target& xg) + { + const mtime_target& g (xg.as ()); + const group_view& gv (g.group_members (a)); + + // Similar logic to clean_extra() above. + // + target_state r (target_state::unchanged); + for (size_t i (0); i != gv.count; ++i) + { + if (const target* m = gv.members[i]) + { + if (rmfile (m->as ().path (), *m)) + r |= target_state::changed; + } + } + + g.mtime (timestamp_nonexistent); + + r |= reverse_execute_prerequisites (a, g); + return r; } } -- cgit v1.1