diff options
Diffstat (limited to 'libbuild2/install')
-rw-r--r-- | libbuild2/install/rule.cxx | 43 | ||||
-rw-r--r-- | libbuild2/install/rule.hxx | 15 |
2 files changed, 39 insertions, 19 deletions
diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx index 7e086a8..788a13f 100644 --- a/libbuild2/install/rule.cxx +++ b/libbuild2/install/rule.cxx @@ -193,10 +193,10 @@ namespace build2 alias_rule::match (a, t); } - const target* group_rule:: - filter (action, const target&, const target& m) const + bool group_rule:: + filter (action, const target&, const target&) const { - return &m; + return true; } pair<const target*, uint64_t> group_rule:: @@ -250,17 +250,16 @@ namespace build2 auto& pts (t.prerequisite_targets[a]); for (size_t i (0); i != gv.count; ++i) { - const target* m (gv.members[i]); + const target* mt (gv.members[i]); - if (m == nullptr) + if (mt == nullptr) continue; // Let a customized rule have its say. // - const target* mt (filter (a, t, *m)); - if (mt == nullptr) + if (!filter (a, t, *mt)) { - l5 ([&]{trace << "ignoring " << *m << " (filtered out)";}); + l5 ([&]{trace << "ignoring " << *mt << " (filtered out)";}); continue; } @@ -300,6 +299,12 @@ namespace build2 return true; } + bool file_rule:: + filter (action, const target&, const target&) const + { + return true; + } + pair<const target*, uint64_t> file_rule:: filter (const scope* is, action a, const target& t, prerequisite_iterator& i, @@ -1177,10 +1182,13 @@ namespace build2 { if (!mf->path ().empty () && mf->mtime () != timestamp_nonexistent) { - if (const path* p = lookup_install<path> (*mf, "install")) + if (filter (a, t, *mf)) { - install_target (*mf, *p, tp.empty () ? 1 : 2); - r |= target_state::changed; + if (const path* p = lookup_install<path> (*mf, "install")) + { + install_target (*mf, *p, tp.empty () ? 1 : 2); + r |= target_state::changed; + } } } } @@ -1556,12 +1564,15 @@ namespace build2 { if (!mf->path ().empty () && mf->mtime () != timestamp_nonexistent) { - if (const path* p = lookup_install<path> (*m, "install")) + if (filter (a, t, *mf)) { - r |= uninstall_target ( - *mf, - *p, - tp.empty () || r != target_state::changed ? 1 : 2); + if (const path* p = lookup_install<path> (*m, "install")) + { + r |= uninstall_target ( + *mf, + *p, + tp.empty () || r != target_state::changed ? 1 : 2); + } } } } diff --git a/libbuild2/install/rule.hxx b/libbuild2/install/rule.hxx index 3f30757..2ddacc6 100644 --- a/libbuild2/install/rule.hxx +++ b/libbuild2/install/rule.hxx @@ -81,12 +81,12 @@ namespace build2 virtual bool match (action, target&) const override; - // Return NULL if this group member should be ignored and pointer to its - // target otherwise. + // Return false if this group member should be ignored and true + // otherwise. Note that this filter is called during apply(). // // The default implementation accepts all members. // - virtual const target* + virtual bool filter (action, const target&, const target& group_member) const; // Return NULL if this prerequisite should be ignored and pointer to its @@ -116,6 +116,15 @@ namespace build2 virtual bool match (action, target&) const override; + // Return false if this ad hoc group member should be ignored and true + // otherwise. Note that this filter is called during execute and only + // for install/uninstall (and not update). + // + // The default implementation accepts all members. + // + virtual bool + filter (action, const target&, const target& adhoc_group_member) const; + // Return NULL if this prerequisite should be ignored and pointer to its // target otherwise. In the latter case, return the match options that // should be used for this prerequisite (use match_extra::all_options |