From 53eb43126e562a43f4e8f2247af10da5c4c3c87f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 12 Aug 2016 16:39:13 +0200 Subject: Rename module to init --- build2/test/init | 31 +++++++++++++++ build2/test/init.cxx | 103 +++++++++++++++++++++++++++++++++++++++++++++++++ build2/test/module | 31 --------------- build2/test/module.cxx | 103 ------------------------------------------------- 4 files changed, 134 insertions(+), 134 deletions(-) create mode 100644 build2/test/init create mode 100644 build2/test/init.cxx delete mode 100644 build2/test/module delete mode 100644 build2/test/module.cxx (limited to 'build2/test') diff --git a/build2/test/init b/build2/test/init new file mode 100644 index 0000000..ec0c4b4 --- /dev/null +++ b/build2/test/init @@ -0,0 +1,31 @@ +// file : build2/test/init -*- C++ -*- +// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BUILD2_TEST_INIT +#define BUILD2_TEST_INIT + +#include +#include + +#include + +namespace build2 +{ + namespace test + { + void + boot (scope&, const location&, unique_ptr&); + + bool + init (scope&, + scope&, + const location&, + unique_ptr&, + bool, + bool, + const variable_map&); + } +} + +#endif // BUILD2_TEST_INIT diff --git a/build2/test/init.cxx b/build2/test/init.cxx new file mode 100644 index 0000000..bd03f00 --- /dev/null +++ b/build2/test/init.cxx @@ -0,0 +1,103 @@ +// file : build2/test/init.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +#include +#include +#include +#include + +#include +#include + +using namespace std; +using namespace butl; + +namespace build2 +{ + namespace test + { + static rule rule_; + + void + boot (scope& root, const location&, unique_ptr&) + { + tracer trace ("test::boot"); + + l5 ([&]{trace << "for " << root.out_path ();}); + + // Register the test operation. + // + root.operations.insert (test_id, test); + + // Enter module variables. Do it during boot in case they get assigned + // in bootstrap.build. + // + { + auto& v (var_pool); + + // Note: none are overridable. + // + v.insert ("test"); + v.insert ("test.input"); + v.insert ("test.output"); + v.insert ("test.roundtrip"); + v.insert ("test.options"); + v.insert ("test.arguments"); + } + } + + bool + init (scope& root, + scope&, + const location& l, + unique_ptr&, + bool first, + bool, + const variable_map& config_hints) + { + tracer trace ("test::init"); + + if (!first) + { + warn (l) << "multiple test module initializations"; + return true; + } + + const dir_path& out_root (root.out_path ()); + l5 ([&]{trace << "for " << out_root;}); + + assert (config_hints.empty ()); // We don't known any hints. + + //@@ TODO: Need ability to specify extra diff options (e.g., + // --strip-trailing-cr, now hardcoded). + + // Adjust module priority so that the config.test.* values are saved at + // the end of config.build. + // + // if (s) + // config::save_module (r, "test", INT32_MAX); + + // Register rules. + // + { + auto& r (root.rules); + + // Register our test running rule. + // + r.insert (perform_test_id, "test", rule_); + + // Register our rule for the dist meta-operation. We need + // to do this because we have "ad-hoc prerequisites" (test + // input/output files) that need to be entered into the + // target list. + // + r.insert (dist_id, test_id, "test", rule_); + } + + return true; + } + } +} diff --git a/build2/test/module b/build2/test/module deleted file mode 100644 index dacb364..0000000 --- a/build2/test/module +++ /dev/null @@ -1,31 +0,0 @@ -// file : build2/test/module -*- C++ -*- -// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#ifndef BUILD2_TEST_MODULE -#define BUILD2_TEST_MODULE - -#include -#include - -#include - -namespace build2 -{ - namespace test - { - void - boot (scope&, const location&, unique_ptr&); - - bool - init (scope&, - scope&, - const location&, - unique_ptr&, - bool, - bool, - const variable_map&); - } -} - -#endif // BUILD2_TEST_MODULE diff --git a/build2/test/module.cxx b/build2/test/module.cxx deleted file mode 100644 index 83ccf3c..0000000 --- a/build2/test/module.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// file : build2/test/module.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include - -#include -#include -#include -#include - -#include -#include - -using namespace std; -using namespace butl; - -namespace build2 -{ - namespace test - { - static rule rule_; - - void - boot (scope& root, const location&, unique_ptr&) - { - tracer trace ("test::boot"); - - l5 ([&]{trace << "for " << root.out_path ();}); - - // Register the test operation. - // - root.operations.insert (test_id, test); - - // Enter module variables. Do it during boot in case they get assigned - // in bootstrap.build. - // - { - auto& v (var_pool); - - // Note: none are overridable. - // - v.insert ("test"); - v.insert ("test.input"); - v.insert ("test.output"); - v.insert ("test.roundtrip"); - v.insert ("test.options"); - v.insert ("test.arguments"); - } - } - - bool - init (scope& root, - scope&, - const location& l, - unique_ptr&, - bool first, - bool, - const variable_map& config_hints) - { - tracer trace ("test::init"); - - if (!first) - { - warn (l) << "multiple test module initializations"; - return true; - } - - const dir_path& out_root (root.out_path ()); - l5 ([&]{trace << "for " << out_root;}); - - assert (config_hints.empty ()); // We don't known any hints. - - //@@ TODO: Need ability to specify extra diff options (e.g., - // --strip-trailing-cr, now hardcoded). - - // Adjust module priority so that the config.test.* values are saved at - // the end of config.build. - // - // if (s) - // config::save_module (r, "test", INT32_MAX); - - // Register rules. - // - { - auto& r (root.rules); - - // Register our test running rule. - // - r.insert (perform_test_id, "test", rule_); - - // Register our rule for the dist meta-operation. We need - // to do this because we have "ad-hoc prerequisites" (test - // input/output files) that need to be entered into the - // target list. - // - r.insert (dist_id, test_id, "test", rule_); - } - - return true; - } - } -} -- cgit v1.1