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/version/init.cxx | 16 ++++++++-------- build2/version/rule.cxx | 22 +++++++++++----------- build2/version/rule.hxx | 12 ++++++------ 3 files changed, 25 insertions(+), 25 deletions(-) (limited to 'build2/version') diff --git a/build2/version/init.cxx b/build2/version/init.cxx index 63e32ab..7b8bd01 100644 --- a/build2/version/init.cxx +++ b/build2/version/init.cxx @@ -27,8 +27,8 @@ namespace build2 { static const path manifest ("manifest"); - static const version_doc version_doc_; - static const version_in version_in_; + static const doc_rule doc_rule_; + static const in_rule in_rule_; bool boot (scope& rs, const location& l, unique_ptr& mod) @@ -311,13 +311,13 @@ namespace build2 { auto& r (rs.rules); - r.insert (perform_update_id, "version.doc", version_doc_); - r.insert (perform_clean_id, "version.doc", version_doc_); - r.insert (configure_update_id, "version.doc", version_doc_); + r.insert (perform_update_id, "version.doc", doc_rule_); + r.insert (perform_clean_id, "version.doc", doc_rule_); + r.insert (configure_update_id, "version.doc", doc_rule_); - r.insert (perform_update_id, "version.in", version_in_); - r.insert (perform_clean_id, "version.in", version_in_); - r.insert (configure_update_id, "version.in", version_in_); + r.insert (perform_update_id, "version.in", in_rule_); + r.insert (perform_clean_id, "version.in", in_rule_); + r.insert (configure_update_id, "version.in", in_rule_); } return true; diff --git a/build2/version/rule.cxx b/build2/version/rule.cxx index 9e127ca..bbfe1f6 100644 --- a/build2/version/rule.cxx +++ b/build2/version/rule.cxx @@ -45,12 +45,12 @@ namespace build2 return d == rs.src_path (); } - // version_doc + // doc_rule // - match_result version_doc:: + bool doc_rule:: match (action a, target& xt, const string&) const { - tracer trace ("version::version_doc::match"); + tracer trace ("version::doc_rule::match"); doc& t (static_cast (xt)); @@ -76,7 +76,7 @@ namespace build2 return false; } - recipe version_doc:: + recipe doc_rule:: apply (action a, target& xt) const { doc& t (static_cast (xt)); @@ -101,7 +101,7 @@ namespace build2 } } - target_state version_doc:: + target_state doc_rule:: perform_update (action a, const target& xt) { const doc& t (xt.as ()); @@ -168,12 +168,12 @@ namespace build2 return target_state::changed; } - // version_in + // in_rule // - match_result version_in:: + bool in_rule:: match (action a, target& xt, const string&) const { - tracer trace ("version::version_in::match"); + tracer trace ("version::in_rule::match"); file& t (static_cast (xt)); const scope& rs (t.root_scope ()); @@ -195,7 +195,7 @@ namespace build2 return fm && fi; } - recipe version_in:: + recipe in_rule:: apply (action a, target& xt) const { file& t (static_cast (xt)); @@ -220,10 +220,10 @@ namespace build2 } } - target_state version_in:: + target_state in_rule:: perform_update (action a, const target& xt) { - tracer trace ("version::version_in::perform_update"); + tracer trace ("version::in_rule::perform_update"); const file& t (xt.as ()); const path& tp (t.path ()); diff --git a/build2/version/rule.hxx b/build2/version/rule.hxx index e686694..9172ba3 100644 --- a/build2/version/rule.hxx +++ b/build2/version/rule.hxx @@ -16,12 +16,12 @@ namespace build2 { // Generate a version file. // - class version_doc: public rule + class doc_rule: public rule { public: - version_doc () {} + doc_rule () {} - virtual match_result + virtual bool match (action, target&, const string&) const override; virtual recipe @@ -33,12 +33,12 @@ namespace build2 // Preprocess an .in file. // - class version_in: public rule + class in_rule: public rule { public: - version_in () {} + in_rule () {} - virtual match_result + virtual bool match (action, target&, const string&) const override; virtual recipe -- cgit v1.1