From 47bf5cd6a167730ee06a1c7cffeae6540f67dde0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 14 Aug 2015 15:48:34 +0200 Subject: Rework meta/operation registration We now have global tables for meta/operation. Plus each can then be enabled on the per-project basis. --- build/test/module.cxx | 30 +++++++++++------------------- build/test/operation.cxx | 4 +--- build/test/rule | 5 ----- 3 files changed, 12 insertions(+), 27 deletions(-) (limited to 'build/test') diff --git a/build/test/module.cxx b/build/test/module.cxx index d5ba754..cba930f 100644 --- a/build/test/module.cxx +++ b/build/test/module.cxx @@ -19,24 +19,18 @@ namespace build { namespace test { - class module: public build::module - { - public: - module (operation_id test_id): rule (test_id) {} - - test::rule rule; - }; + static rule rule_; extern "C" void - test_init (scope& root, - scope& base, + test_init (scope& r, + scope& b, const location& l, - unique_ptr& r, + unique_ptr&, bool first) { tracer trace ("test::init"); - if (&root != &base) + if (&r != &b) fail (l) << "test module must be initialized in bootstrap.build"; if (!first) @@ -45,17 +39,17 @@ namespace build return; } - const dir_path& out_root (root.path ()); + const dir_path& out_root (r.path ()); level4 ([&]{trace << "for " << out_root;}); // Register the test operation. // - operation_id test_id (root.operations.insert (test)); - - unique_ptr m (new module (test_id)); + r.operations.insert (test_id, test); + // Register rules. + // { - auto& rs (base.rules); + auto& rs (r.rules); // Register the standard alias rule for the test operation. // @@ -63,10 +57,8 @@ namespace build // Register our test running rule. // - rs.insert (test_id, "test", m->rule); + rs.insert (test_id, "test", rule_); } - - r = move (m); } } } diff --git a/build/test/operation.cxx b/build/test/operation.cxx index da98e7d..40c5b86 100644 --- a/build/test/operation.cxx +++ b/build/test/operation.cxx @@ -4,8 +4,6 @@ #include -#include - using namespace std; using namespace butl; @@ -18,7 +16,7 @@ namespace build { // Run update as a pre-operation, unless we are disfiguring. // - return mo != config::disfigure_id ? update_id : 0; + return mo != disfigure_id ? update_id : 0; } operation_info test { diff --git a/build/test/rule b/build/test/rule index 259b72b..17f32ce 100644 --- a/build/test/rule +++ b/build/test/rule @@ -15,8 +15,6 @@ namespace build class rule: public build::rule { public: - rule (operation_id o): test_id (o) {} - virtual match_result match (action, target&, const std::string&) const; @@ -25,9 +23,6 @@ namespace build static target_state perform_test (action, target&); - - private: - operation_id test_id; }; } } -- cgit v1.1