diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-11-16 13:48:40 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-11-16 13:48:40 +0200 |
commit | 23b059eea0618220010b30bacbf97db7f642c870 (patch) | |
tree | b197c61083468530e0fc2305c630f7fa7cd6b97c /libbuild2/target.ixx | |
parent | a7513ddd6250dada74d241abf8551828b16cb554 (diff) |
Fix target::group_state() for unmatched ad hoc group members
Diffstat (limited to 'libbuild2/target.ixx')
-rw-r--r-- | libbuild2/target.ixx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libbuild2/target.ixx b/libbuild2/target.ixx index 8136fe9..69b2776 100644 --- a/libbuild2/target.ixx +++ b/libbuild2/target.ixx @@ -273,9 +273,6 @@ namespace build2 } } - LIBBUILD2_SYMEXPORT target_state - group_action (action, const target&); // <libbuild2/algorithm.hxx> - inline bool target:: group_state (action a) const { @@ -289,6 +286,19 @@ namespace build2 // @@ Hm, I wonder why not just return s.recipe_group_action now that we // cache it. // + + // This special hack allows us to do things like query an ad hoc member's + // state or mtime without matching/executing the member, only the group. + // Requiring matching/executing the member would be too burdensome and + // this feels harmless (ad hoc membership cannot be changed during the + // execute phase). + // + // Note: this test must come first since the member may not be matched and + // thus its state uninitialized. + // + if (ctx.phase == run_phase::execute && adhoc_group_member ()) + return true; + const opstate& s (state[a]); if (s.state == target_state::group) |