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 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'build/test/module.cxx') 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); } } } -- cgit v1.1