From 682836daacdd3dc486187c9d60479b372895a470 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 29 Jul 2017 10:32:36 +0200 Subject: Implement "see through" installation semantics for utility libraries --- build2/install/rule.cxx | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'build2/install/rule.cxx') diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx index 8611247..f2fc233 100644 --- a/build2/install/rule.cxx +++ b/build2/install/rule.cxx @@ -38,20 +38,32 @@ namespace build2 // alias_rule // + const alias_rule alias_rule::instance; + match_result alias_rule:: match (action, target&, const string&) const { return true; } + const target* alias_rule:: + filter (action, const target& t, prerequisite_member p) const + { + return &p.search (t); + } + recipe alias_rule:: apply (action a, target& t) const { tracer trace ("install::alias_rule::apply"); - for (const prerequisite& p: group_prerequisites (t)) + for (prerequisite_member p: group_prerequisite_members (a, t)) { - const target& pt (search (t, p)); + // Let a customized rule have its say. + // + const target* pt (filter (a, t, p)); + if (pt == nullptr) + continue; // Check if this prerequisite is explicitly "not installable", // that is, there is the 'install' variable and its value is @@ -65,16 +77,15 @@ namespace build2 // // Note: not the same as lookup() above. // - auto l (pt["install"]); - + auto l ((*pt)["install"]); if (l && cast (l).string () == "false") { - l5 ([&]{trace << "ignoring " << pt;}); + l5 ([&]{trace << "ignoring " << *pt;}); continue; } - build2::match (a, pt); - t.prerequisite_targets.push_back (&pt); + build2::match (a, *pt); + t.prerequisite_targets.push_back (pt); } return default_recipe; @@ -82,6 +93,8 @@ namespace build2 // file_rule // + const file_rule file_rule::instance; + struct match_data { bool install; -- cgit v1.1