From 9891b20350021ce41a950645dd76df20a45c92cc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 2 Dec 2015 11:37:15 +0200 Subject: Implement optional module loading The syntax is: using? cli Now each module use results in two bool variables: .loaded and .configured. Also implement variable visibility (the above two variables are limited to project). --- build/dist/module | 6 ++++-- build/dist/module.cxx | 27 +++++++++++++++------------ build/dist/operation.cxx | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'build/dist') diff --git a/build/dist/module b/build/dist/module index 9fad86f..20082ec 100644 --- a/build/dist/module +++ b/build/dist/module @@ -6,15 +6,17 @@ #define BUILD_DIST_MODULE #include +#include + #include namespace build { namespace dist { - extern "C" void + extern "C" bool dist_init ( - scope&, scope&, const location&, std::unique_ptr&, bool); + scope&, scope&, const location&, unique_ptr&, bool, bool); } } diff --git a/build/dist/module.cxx b/build/dist/module.cxx index 9bd058a..a624c20 100644 --- a/build/dist/module.cxx +++ b/build/dist/module.cxx @@ -22,12 +22,13 @@ namespace build { static rule rule_; - extern "C" void + extern "C" bool dist_init (scope& r, scope& b, const location& l, - std::unique_ptr&, - bool first) + unique_ptr&, + bool first, + bool) { tracer trace ("dist::init"); @@ -37,7 +38,7 @@ namespace build if (!first) { warn (l) << "multiple dist module initializations"; - return; + return true; } const dir_path& out_root (r.out_path ()); @@ -58,20 +59,20 @@ namespace build // if (first) { - variable_pool.find ("dist", bool_type); + var_pool.find ("dist", bool_type); - variable_pool.find ("dist.package", string_type); + var_pool.find ("dist.package", string_type); - variable_pool.find ("dist.root", dir_path_type); - variable_pool.find ("config.dist.root", dir_path_type); + var_pool.find ("dist.root", dir_path_type); + var_pool.find ("config.dist.root", dir_path_type); //@@ VAR type // - variable_pool.find ("dist.cmd", string_type); - variable_pool.find ("config.dist.cmd", string_type); + var_pool.find ("dist.cmd", string_type); + var_pool.find ("config.dist.cmd", string_type); - variable_pool.find ("dist.archives", strings_type); - variable_pool.find ("config.dist.archives", strings_type); + var_pool.find ("dist.archives", strings_type); + var_pool.find ("config.dist.archives", strings_type); } // Configuration. @@ -127,6 +128,8 @@ namespace build v = cv; } } + + return true; } } } diff --git a/build/dist/operation.cxx b/build/dist/operation.cxx index 2a84894..0069432 100644 --- a/build/dist/operation.cxx +++ b/build/dist/operation.cxx @@ -199,7 +199,7 @@ namespace build // entered. // action_targets files; - const variable& dist_var (variable_pool.find ("dist")); + const variable& dist_var (var_pool.find ("dist")); for (const auto& pt: targets) { -- cgit v1.1