From 152f83d22861129dba48404632b61b3f00f18715 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Oct 2023 05:40:52 +0200 Subject: WIP: install: ad hoc members --- libbuild2/install/rule.cxx | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'libbuild2/install/rule.cxx') 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 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 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 (*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 (*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 (*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 (*m, "install")) + { + r |= uninstall_target ( + *mf, + *p, + tp.empty () || r != target_state::changed ? 1 : 2); + } } } } -- cgit v1.1