diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-10-10 12:39:42 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-10-10 12:39:42 +0200 |
commit | 41c1f41245db26acb1bb8c624bae47140bcc56aa (patch) | |
tree | ebb8eadd2c1f2ca99890d6d58522960061c18da9 /libbuild2 | |
parent | eeb155ebc35c5947234f731c333e2bd71ea88974 (diff) |
Don't match group-based targets with fallback rule during configure (GH #364)
Membership of such targets can only be accurately determined by the ad hoc
recipe.
Diffstat (limited to 'libbuild2')
-rw-r--r-- | libbuild2/build/script/builtin.cli | 7 | ||||
-rw-r--r-- | libbuild2/config/init.cxx | 3 | ||||
-rw-r--r-- | libbuild2/rule.cxx | 4 | ||||
-rw-r--r-- | libbuild2/rule.hxx | 13 |
4 files changed, 19 insertions, 8 deletions
diff --git a/libbuild2/build/script/builtin.cli b/libbuild2/build/script/builtin.cli index 5aea034..9639477 100644 --- a/libbuild2/build/script/builtin.cli +++ b/libbuild2/build/script/builtin.cli @@ -103,9 +103,10 @@ namespace build2 // Dynamic target extraction options. // // This functionality is enabled with the --dyn-target option. Only - // the make format is supported, where the listed targets are added as - // ad hoc group members (unless already specified as static members). - // This functionality is not available in the byproduct mode. + // the `make` and `lines` formats are supported (see above), where the + // listed targets are added as ad hoc group members (unless already + // specified as static members). This functionality is not available + // in the byproduct mode. // string --target-what; // Target kind, e.g., "source". diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx index b8ba31d..776299c 100644 --- a/libbuild2/config/init.cxx +++ b/libbuild2/config/init.cxx @@ -27,6 +27,7 @@ namespace build2 namespace config { static const file_rule file_rule_ (true /* check_type */); + static const noop_rule noop_rule_ (true /* exclude_group */); void functions (function_map&); // functions.cxx @@ -733,7 +734,7 @@ namespace build2 // This allows a custom configure rule while doing nothing by default. // - rs.insert_rule<target> (configure_id, 0, "config.noop", noop_rule::instance); + rs.insert_rule<target> (configure_id, 0, "config.noop", noop_rule_); // We need this rule for out-of-any-project dependencies (for example, // libraries imported from /usr/lib). We are registering it on the diff --git a/libbuild2/rule.cxx b/libbuild2/rule.cxx index dc1c96c..b504dc7 100644 --- a/libbuild2/rule.cxx +++ b/libbuild2/rule.cxx @@ -430,9 +430,9 @@ namespace build2 // noop_rule // bool noop_rule:: - match (action, target&) const + match (action, target& t) const { - return true; + return !exclude_group_ || !t.is_a<group> (); } recipe noop_rule:: diff --git a/libbuild2/rule.hxx b/libbuild2/rule.hxx index eceb6ad..71782c0 100644 --- a/libbuild2/rule.hxx +++ b/libbuild2/rule.hxx @@ -209,8 +209,17 @@ namespace build2 virtual recipe apply (action, target&) const override; - noop_rule () {} - static const noop_rule instance; + // If exclude_group is true then exclude the group-based targets (since + // their membership can only be accurately determined by the ad hoc + // recipe). + // + explicit + noop_rule (bool exclude_group = false): exclude_group_ (exclude_group) {} + + static const noop_rule instance; // Note: does not exclude group. + + private: + bool exclude_group_; }; // Ad hoc rule. |