aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/dyndep.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-05-30 05:51:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-05-30 11:23:09 +0200
commitde2daaa41ec6064181e6b9e73a34c32cd0008242 (patch)
tree4978e5c28aae5ffbff3198e7fda54903ac09f92b /libbuild2/dyndep.hxx
parent74b8dd5bf57dd351b844c6fe407c60f18043d597 (diff)
Store dynamic group member types in depdb, use in clean
Diffstat (limited to 'libbuild2/dyndep.hxx')
-rw-r--r--libbuild2/dyndep.hxx49
1 files changed, 28 insertions, 21 deletions
diff --git a/libbuild2/dyndep.hxx b/libbuild2/dyndep.hxx
index ee9c1dd..1de2858 100644
--- a/libbuild2/dyndep.hxx
+++ b/libbuild2/dyndep.hxx
@@ -228,40 +228,41 @@ namespace build2
const srcout_map& = {});
// Find or insert a target file path as a target of the specified type,
- // make it a member of the specified (non-ad hoc) mtime target group,
- // set its path, and match it with group_recipe.
+ // make it a member of the specified (non-ad hoc) mtime target group and
+ // set its path. Return the target and an indication of whether it was
+ // made a member (can only be false if a filter is provided; see below).
//
// The file path must be absolute and normalized. Note that this function
// assumes that this member can only be matched via this group. The group
// type must have the target_type::flag::dyn_members flag.
//
- // Note: we can split this function into {enter,match}_group_member()
- // if necessary.
+ // If specified, the group_filter function is called on the target before
+ // making it a group member, skipping it if this function returns false.
+ // Note that the filter is skipped if the target is newly inserted (the
+ // filter is meant to be used to skip duplicates).
//
- static const file&
+ using group_filter_func = bool (mtime_target& g, const file&);
+
+ static pair<const file&, bool>
inject_group_member (action, const scope& base, mtime_target&,
- path, const target_type&);
+ path,
+ const target_type&,
+ const function<group_filter_func>& = nullptr);
template <typename T>
- static const T&
- inject_group_member (action a, const scope& bs, mtime_target& g, path f)
+ static pair<const T&, bool>
+ inject_group_member (action a, const scope& bs, mtime_target& g,
+ path f,
+ const function<group_filter_func>& filter = nullptr)
{
return inject_group_member (
- a, bs, g, move (f), T::static_type).template as<T> ();
+ a, bs, g, move (f), T::static_type, filter).template as<T> ();
}
// As above but the target type is determined using the map_extension
// function if specified, falling back to the fallback type if unable to
- // (the what argument is used for diagnostics during this process). Return
- // the target and an indication of whether it was made a member.
+ // (the what argument is used for diagnostics during this process).
//
- // If specified, the group_filter function is called on the target before
- // making it a group member, skipping it if this function returns false.
- // Note that the filter is skipped if the target is newly inserted (the
- // filter is meant to be used to skip duplicates).
- //
- using group_filter_func = bool (mtime_target& g, const file&);
-
static pair<const file&, bool>
inject_group_member (const char* what,
action, const scope& base, mtime_target& g,
@@ -275,13 +276,19 @@ namespace build2
// specified ad hoc group unless it already is, and set its path. Return
// the target and an indication of whether it was added as a member.
//
- // The target type is determined using the map_extension function if
- // specified, falling back to the fallback type if unable to.
- //
// The file path must be absolute and normalized. Note that this function
// assumes that this target can only be known as a member of this group.
//
static pair<const file&, bool>
+ inject_adhoc_group_member (action, const scope& base, target& g,
+ path,
+ const target_type&);
+
+ // As above but the target type is determined using the map_extension
+ // function if specified, falling back to the fallback type if unable to
+ // (the what argument is used for diagnostics during this process).
+ //
+ static pair<const file&, bool>
inject_adhoc_group_member (const char* what,
action, const scope& base, target& g,
path,