diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-14 15:48:34 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-14 15:48:34 +0200 |
commit | 47bf5cd6a167730ee06a1c7cffeae6540f67dde0 (patch) | |
tree | 7c9c07d33b41be75d1a5d6ec40c153beda2a2a19 /build/test | |
parent | f62ff2e840fd92a03b4a3298de938d426f8b5c7a (diff) |
Rework meta/operation registration
We now have global tables for meta/operation. Plus each can
then be enabled on the per-project basis.
Diffstat (limited to 'build/test')
-rw-r--r-- | build/test/module.cxx | 30 | ||||
-rw-r--r-- | build/test/operation.cxx | 4 | ||||
-rw-r--r-- | build/test/rule | 5 |
3 files changed, 12 insertions, 27 deletions
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<build::module>& r, + unique_ptr<build::module>&, 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<module> 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<target> (test_id, "test", m->rule); + rs.insert<target> (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 <build/test/operation> -#include <build/config/operation> - 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; }; } } |