From fe6f3ec0868185511f5acefb2729eb879798f052 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 17 Jul 2018 13:18:17 +0200 Subject: Reimplement version::in_rule in terms of in::rule Significantly, the version::in_rule rule now track changes to the substitution values. --- build2/in/rule.hxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'build2/in/rule.hxx') diff --git a/build2/in/rule.hxx b/build2/in/rule.hxx index a68e80c..17fbaed 100644 --- a/build2/in/rule.hxx +++ b/build2/in/rule.hxx @@ -16,11 +16,24 @@ namespace build2 { // Preprocess an .in file. // + // Note that a derived rule can use the target data pad to cache data + // (e.g., in match()) to be used in substitute/lookup() calls. + // class rule: public build2::rule { public: - rule (char symbol = '$', bool strict = true) - : symbol_ (symbol), strict_ (strict) {} + // The rule id is used to form the rule name/version entry in depdb. The + // program argument is the pseudo-program name to use in the command + // line diagnostics. + // + rule (string rule_id, + string program, + char symbol = '$', + bool strict = true) + : rule_id_ (move (rule_id)), + program_ (move (program)), + symbol_ (symbol), + strict_ (strict) {} virtual bool match (action, target&, const string&) const override; @@ -46,6 +59,8 @@ namespace build2 perform_update (action, const target&) const; protected: + const string rule_id_; + const string program_; char symbol_; bool strict_; }; -- cgit v1.1