aboutsummaryrefslogtreecommitdiff
path: root/build2/install/rule.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-01-20 13:46:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-03 14:35:45 +0200
commit934f2a9a90c5cad3cdc8a66b50c17827a3ddbcee (patch)
treef35f106e5369e98350327c79080c571195234c0b /build2/install/rule.hxx
parent280f4a5bf787587227ca193cd59c6bd74091db70 (diff)
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.
Diffstat (limited to 'build2/install/rule.hxx')
-rw-r--r--build2/install/rule.hxx73
1 files changed, 45 insertions, 28 deletions
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 () {}
};
}
}