diff options
-rw-r--r-- | build2/cli/init.cxx | 16 | ||||
-rw-r--r-- | libbuild2/parser.cxx | 6 | ||||
-rw-r--r-- | libbuild2/scope.hxx | 26 |
3 files changed, 36 insertions, 12 deletions
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx index 2a07196..a00fd7f 100644 --- a/build2/cli/init.cxx +++ b/build2/cli/init.cxx @@ -246,6 +246,9 @@ namespace build2 // Register our rules. // + // Other rules (e.g., cc::compile) may need to have the group members + // resolved/linked up. Looks like a general pattern: groups should + // resolve on *(update). { auto reg = [&rs, &m] (meta_operation_id mid, operation_id oid) { @@ -255,17 +258,8 @@ namespace build2 rs.insert_rule<cxx::ixx> (mid, oid, "cli.compile", m); }; - reg (perform_id, update_id); - reg (perform_id, clean_id); - - // Other rules (e.g., cc::compile) may need to have the group members - // resolved/linked up. Looks like a general pattern: groups should - // resolve on *(update). - // - // @@ meta-op wildcard? - // - reg (configure_id, update_id); - reg (dist_id, update_id); + reg (0 /* wildcard */, update_id); + reg (perform_id, clean_id); } return true; diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index 9f69117..f42666b 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -1171,6 +1171,12 @@ namespace build2 skip: ; } + + // @@ TODO: if this rule does dynamic member discovery of a + // see-through target group, then we may also need to + // register update for other meta-operations (see, for + // example, wildcard update registration in the cli + // module). } } } diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx index f82db72..e3ebdef 100644 --- a/libbuild2/scope.hxx +++ b/libbuild2/scope.hxx @@ -423,13 +423,37 @@ namespace build2 rules.insert<T> (a, move (hint), r); } + // 0 meta-operation id is treated as an (emulated) wildcard. + // + // Emulated means that we just iterate over all the meta-operations known + // to this project (and they should all be known at this point) and + // register the rule for each of them. + // template <typename T> void insert_rule (meta_operation_id mid, operation_id oid, string hint, const rule& r) { - rules.insert<T> (mid, oid, move (hint), r); + if (mid != 0) + rules.insert<T> (mid, oid, move (hint), r); + else + { + auto& ms (root_scope ()->root_extra->meta_operations); + + for (size_t i (1), n (ms.size ()); i != n; ++i) + { + // Skip a few well-known meta-operations that cannot possibly + // trigger a rule match. + // + if (ms[i] != nullptr && + i != noop_id && + i != info_id && + i != create_id && + i != disfigure_id) + rules.insert<T> (i, oid, hint, r); + } + } } // Operation callbacks. |