aboutsummaryrefslogtreecommitdiff
path: root/build2/config/module
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-21 15:39:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-21 15:39:52 +0200
commitc1d08dbc56d0c8d3346deaba5d6b1946b6d711f4 (patch)
treede85880067c80e56d83de8e3902d95f2c2f9d7c5 /build2/config/module
parent01fe759b58fbde7f8c7391122421dd08c754dc51 (diff)
Save config vars in order specified rather than alphabetically
This way we can group them semantically which results in easier to understand config.build output.
Diffstat (limited to 'build2/config/module')
-rw-r--r--build2/config/module38
1 files changed, 31 insertions, 7 deletions
diff --git a/build2/config/module b/build2/config/module
index aed85a5..5becfd4 100644
--- a/build2/config/module
+++ b/build2/config/module
@@ -17,15 +17,39 @@ namespace build2
{
namespace config
{
- struct module: module_base
+ // An ordered list of modules each with an ordered list of list of
+ // config.* variables and their "save flags" (see save_variable()) that
+ // are used (as opposed to just being specified) in this configuration.
+ // Populated by the config utility functions (required(), optional())
+ // and saved in the order populated.
+ //
+ struct saved_variable
+ {
+ reference_wrapper<const variable> var;
+ uint64_t flags;
+ };
+
+ using saved_variables = vector<saved_variable>;
+
+ struct saved_modules: butl::prefix_map<string, saved_variables, '.'>
{
- // A sorted list of config.* variables and their "save flags" (see
- // save_variable()) that are used (as opposed to just being specified)
- // in this configuration. Populated by the config utility functions
- // (required(), optional())
- //
- butl::prefix_map<variable_cref, uint64_t, '.'> vars;
+ vector<const_iterator> sequence;
+
+ iterator
+ insert (string name)
+ {
+ auto p (emplace (move (name), saved_variables ()));
+ if (p.second)
+ sequence.push_back (p.first);
+
+ return p.first;
+ }
+ };
+
+ struct module: module_base
+ {
+ config::saved_modules saved_modules;
static const string name;
};