aboutsummaryrefslogtreecommitdiff
path: root/build2/install/rule.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-05 12:02:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-05 12:02:32 +0200
commit1bb564a690e2661094e9071d4003638390a5a6fe (patch)
tree48ed8eedb1f87fd05eb66547c12349bb3db92c2b /build2/install/rule.hxx
parent7005f1f5b525705fa3fd458a840d027046a2085b (diff)
Fix test and install rules to handle see-through groups correctly
Diffstat (limited to 'build2/install/rule.hxx')
-rw-r--r--build2/install/rule.hxx39
1 files changed, 35 insertions, 4 deletions
diff --git a/build2/install/rule.hxx b/build2/install/rule.hxx
index b9699e3..2ad3d4b 100644
--- a/build2/install/rule.hxx
+++ b/build2/install/rule.hxx
@@ -25,8 +25,17 @@ namespace build2
// Return NULL if this prerequisite should be ignored and pointer to its
// target otherwise. The default implementation accepts all prerequsites.
//
+ // The prerequisite it passed as an iterator allowing the filter to
+ // "see" inside groups.
+ //
+ using prerequisite_iterator =
+ prerequisite_members_range<group_prerequisites>::iterator;
+
+ virtual const target*
+ filter (action, const target&, prerequisite_iterator&) const;
+
virtual const target*
- filter (action, const target&, prerequisite_member) const;
+ filter (action, const target&, const prerequisite&) const;
virtual recipe
apply (action, target&) const override;
@@ -38,10 +47,19 @@ namespace build2
// In addition to the alias rule's semantics, this rule sees through to
// the group's members.
//
+ // The default group_rule::instance matches any target for which it was
+ // registered. It is to be used for non-see-through groups that should
+ // exhibit the see-through behavior for install (see lib{} in the bin
+ // module for an example).
+ //
+ // We also register (for all targets) another instance of this rule that
+ // only matches see-through groups.
+ //
class group_rule: public alias_rule
{
public:
- using alias_rule::filter; // "Unhide" to make Clang happy.
+ virtual bool
+ match (action, target&, const string&) const override;
// Return NULL if this group member should be ignored and pointer to its
// target otherwise. The default implementation accepts all members.
@@ -49,11 +67,15 @@ namespace build2
virtual const target*
filter (action, const target&, const target& group_member) const;
+ using alias_rule::filter; // "Unhide" to make Clang happy.
+
virtual recipe
apply (action, target&) const override;
- group_rule () {}
+ group_rule (bool see_through_only): see_through (see_through_only) {}
static const group_rule instance;
+
+ bool see_through;
};
struct install_dir;
@@ -68,8 +90,17 @@ namespace build2
// target otherwise. The default implementation ignores prerequsites
// that are outside of this target's project.
//
+ // The prerequisite it passed as an iterator allowing the filter to
+ // "see" inside groups.
+ //
+ using prerequisite_iterator =
+ prerequisite_members_range<group_prerequisites>::iterator;
+
+ virtual const target*
+ filter (action, const target&, prerequisite_iterator&) const;
+
virtual const target*
- filter (action, const target&, prerequisite_member) const;
+ filter (action, const target&, const prerequisite&) const;
virtual recipe
apply (action, target&) const override;