aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-02-14 09:42:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-02-14 09:42:57 +0200
commitd0385d4be5f6a483de2d6b1a506d576d08ed547a (patch)
treed02191f4adf6eb2095fe91999813b47627c46c19 /libbuild2/algorithm.cxx
parent53b6896e48aaa6ee2b414bd36275263c57b490f8 (diff)
Add search_prerequisite*() variants of match_prerequisite*() versions
Diffstat (limited to 'libbuild2/algorithm.cxx')
-rw-r--r--libbuild2/algorithm.cxx33
1 files changed, 26 insertions, 7 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index 26fad23..36d45b2 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -1719,7 +1719,8 @@ namespace build2
match_prerequisite_range (action a, target& t,
R&& r,
const S& ms,
- const scope* s)
+ const scope* s,
+ bool search_only)
{
auto& pts (t.prerequisite_targets[a]);
@@ -1740,7 +1741,10 @@ namespace build2
// Start asynchronous matching of prerequisites. Wait with unlocked phase
// to allow phase switching.
//
- wait_guard wg (t.ctx, t.ctx.count_busy (), t[a].task_count, true);
+ wait_guard wg (
+ search_only
+ ? wait_guard ()
+ : wait_guard (t.ctx, t.ctx.count_busy (), t[a].task_count, true));
for (auto&& p: forward<R> (r))
{
@@ -1760,10 +1764,15 @@ namespace build2
(s != nullptr && !pt.target->in (*s)))
continue;
- match_async (a, *pt.target, t.ctx.count_busy (), t[a].task_count);
+ if (!search_only)
+ match_async (a, *pt.target, t.ctx.count_busy (), t[a].task_count);
+
pts.push_back (move (pt));
}
+ if (search_only)
+ return;
+
wg.wait ();
// Finish matching all the targets that we have started.
@@ -1778,17 +1787,27 @@ namespace build2
void
match_prerequisites (action a, target& t,
const match_search& ms,
- const scope* s)
+ const scope* s,
+ bool search_only)
{
- match_prerequisite_range (a, t, group_prerequisites (t), ms, s);
+ match_prerequisite_range (a, t,
+ group_prerequisites (t),
+ ms,
+ s,
+ search_only);
}
void
match_prerequisite_members (action a, target& t,
const match_search_member& msm,
- const scope* s)
+ const scope* s,
+ bool search_only)
{
- match_prerequisite_range (a, t, group_prerequisite_members (a, t), msm, s);
+ match_prerequisite_range (a, t,
+ group_prerequisite_members (a, t),
+ msm,
+ s,
+ search_only);
}
void