aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/rule.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-06-02 08:34:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-06-08 15:43:08 +0200
commit1346f4cd0d20a5dc7e0471edbbb6ce00f2da5c18 (patch)
tree25a2b70304520bac33aede420ab2ad7715791d69 /libbuild2/rule.hxx
parentc5feaaf745421f2ecda672585c462cf4c807d25d (diff)
Redo fallback reverse operation machinery in ad hoc recipes
Diffstat (limited to 'libbuild2/rule.hxx')
-rw-r--r--libbuild2/rule.hxx28
1 files changed, 12 insertions, 16 deletions
diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx
index 4b05379..af89124 100644
--- a/libbuild2/rule.hxx
+++ b/libbuild2/rule.hxx
@@ -24,13 +24,12 @@ namespace build2
//
// Note: match() is only called once but may not be followed by apply().
//
- // The match_extra argument is used to pass additional information that is
- // only needed by some rule implementations. It is also a way for us to
- // later pass more information without breaking source compatibility.
+ // The match_extra argument (the type is defined in target.hxx) is used to
+ // pass additional information that is only needed by some rule
+ // implementations. It is also a way for us to later pass more information
+ // without breaking source compatibility.
//
- struct match_extra
- {
- };
+ struct match_extra;
class LIBBUILD2_SYMEXPORT rule
{
@@ -172,18 +171,15 @@ namespace build2
public:
// Some of the operations come in compensating pairs, such as update and
// clean, install and uninstall. An ad hoc rule implementation may choose
- // to provide a fallback implementation of a compensating operation if it
- // is providing the other half (passed in the fallback argument).
- //
- // The default implementation calls rule::match() if fallback is absent
- // and returns false if fallback is present. So an implementation that
- // doesn't care about this semantics can implement the straight rule
- // interface.
+ // to provide a fallback implementation of a reverse operation if it is
+ // providing the other half.
//
- virtual bool
- match (action, target&, const string&, match_extra&,
- optional<action> fallback) const;
+ virtual optional<action>
+ reverse_fallback (action, const target_type&) const;
+ // The default implementation forwards to the pattern's match() if there
+ // is a pattern and returns true otherwise.
+ //
virtual bool
match (action, target&, const string&, match_extra&) const override;