diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-04-28 08:48:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-27 08:35:29 +0200 |
commit | 05ae6014aa01a8347844cce89085bdcb591160f0 (patch) | |
tree | 75432dccbc84dc70a55e0672c8594fc9907227fb /libbuild2/rule.cxx | |
parent | 3552356a87402727e663131994fa87f48b3cd4fb (diff) |
Add ad hoc recipes plumbing
Diffstat (limited to 'libbuild2/rule.cxx')
-rw-r--r-- | libbuild2/rule.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index 3a32eed..a57aaaa 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -305,4 +305,28 @@ namespace build2 } const noop_rule noop_rule::instance; + + // adhoc_rule + // + bool adhoc_rule:: + match (action a, target& t, const string&) const + { + // @@ Should we be looking for outer/inner and then just inner, like in + // rule match? See match_rule() for the normal rule semantics. + // + auto i (find_if (t.adhoc_recipes.begin (), + t.adhoc_recipes.end (), + [a] (const adhoc_recipe& r) {return r.action == a;})); + + return i != t.adhoc_recipes.end (); + } + + recipe adhoc_rule:: + apply (action, target&) const + { + return empty_recipe; + } + + const adhoc_rule adhoc_rule::instance; + const rule_match adhoc_rule::match_instance {"adhoc", adhoc_rule::instance}; } |