From 934f2a9a90c5cad3cdc8a66b50c17827a3ddbcee Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 20 Jan 2018 13:46:11 +0200 Subject: Get rid of action rule override semantics Instead we now have two more or less separate match states for outer and inner parts of an action. --- build2/install/rule.hxx | 73 ++++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 28 deletions(-) (limited to 'build2/install/rule.hxx') diff --git a/build2/install/rule.hxx b/build2/install/rule.hxx index 642ab96..ffab206 100644 --- a/build2/install/rule.hxx +++ b/build2/install/rule.hxx @@ -19,21 +19,39 @@ namespace build2 class alias_rule: public rule { public: - static const alias_rule instance; - - alias_rule () {} - - virtual match_result + virtual bool match (action, target&, const string&) const override; - virtual recipe - apply (action, target&) const override; - // Return NULL if this prerequisite should be ignored and pointer to its // target otherwise. The default implementation accepts all prerequsites. // virtual const target* filter (action, const target&, prerequisite_member) const; + + virtual recipe + apply (action, target&) const override; + + alias_rule () {} + static const alias_rule instance; + }; + + // In addition to the alias rule's semantics, this rule sees through to + // the group's members. + // + class group_rule: public alias_rule + { + public: + // Return NULL if this group member should be ignored and pointer to its + // target otherwise. The default implementation accepts all members. + // + virtual const target* + filter (action, const target&, const target& group_member) const; + + virtual recipe + apply (action, target&) const override; + + group_rule () {} + static const group_rule instance; }; struct install_dir; @@ -41,41 +59,38 @@ namespace build2 class file_rule: public rule { public: - static const file_rule instance; - - file_rule () {} - - virtual match_result + virtual bool match (action, target&, const string&) const override; - virtual recipe - apply (action, target&) const override; - // Return NULL if this prerequisite should be ignored and pointer to its - // target otherwise. The default implementation ignores prerequsites that - // are outside of this target's project. + // target otherwise. The default implementation ignores prerequsites + // that are outside of this target's project. // virtual const target* filter (action, const target&, prerequisite_member) const; - // Extra installation hooks. + virtual recipe + apply (action, target&) const override; + + static target_state + perform_update (action, const target&); + + // Extra un/installation hooks. Return true if anything was + // un/installed. // - using install_dir = install::install_dir; + using install_dir = install::install_dir; // For derived rules. - virtual void + virtual bool install_extra (const file&, const install_dir&) const; - // Return true if anything was uninstalled. - // virtual bool uninstall_extra (const file&, const install_dir&) const; - // Installation "commands". + // Installation/uninstallation "commands". // // If verbose is false, then only print the command at verbosity level 2 // or higher. - // - public: + // Install a symlink: base/link -> target. // static void @@ -96,16 +111,18 @@ namespace build2 static bool uninstall_f (const scope& rs, const install_dir& base, - const file* t, + const file* target, const path& name, bool verbose); - protected: target_state perform_install (action, const target&) const; target_state perform_uninstall (action, const target&) const; + + static const file_rule instance; + file_rule () {} }; } } -- cgit v1.1