From 05ae6014aa01a8347844cce89085bdcb591160f0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 28 Apr 2020 08:48:53 +0200 Subject: Add ad hoc recipes plumbing --- libbuild2/rule.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'libbuild2/rule.cxx') 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}; } -- cgit v1.1