From 0d0d9a9c56822919e9794658d31db57f8fc3e2bf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Dec 2015 13:54:59 +0200 Subject: Implement two-phase initialization of modules loaded from bootstrap.build --- build/test/module.cxx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'build/test/module.cxx') diff --git a/build/test/module.cxx b/build/test/module.cxx index 19a31d2..9372103 100644 --- a/build/test/module.cxx +++ b/build/test/module.cxx @@ -21,9 +21,21 @@ namespace build { static rule rule_; + extern "C" void + test_boot (scope& root, const location&, unique_ptr&) + { + tracer trace ("test::boot"); + + level5 ([&]{trace << "for " << root.out_path ();}); + + // Register the test operation. + // + root.operations.insert (test_id, test); + } + extern "C" bool test_init (scope& root, - scope& base, + scope&, const location& l, unique_ptr&, bool first, @@ -31,9 +43,6 @@ namespace build { tracer trace ("test::init"); - if (&root != &base) - fail (l) << "test module must be initialized in bootstrap.build"; - if (!first) { warn (l) << "multiple test module initializations"; @@ -56,10 +65,6 @@ namespace build v.find ("test.arguments", strings_type); } - // Register the test operation. - // - root.operations.insert (test_id, test); - // Register rules. // { -- cgit v1.1