From f8de93520fd604a3771a2af3ca9564f6085d8baa Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 1 Dec 2022 10:00:37 +0200 Subject: Make dist::rule reusable as base --- libbuild2/dist/rule.cxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'libbuild2/dist/rule.cxx') diff --git a/libbuild2/dist/rule.cxx b/libbuild2/dist/rule.cxx index 7233eba..736490e 100644 --- a/libbuild2/dist/rule.cxx +++ b/libbuild2/dist/rule.cxx @@ -8,6 +8,9 @@ #include #include +#include +#include + using namespace std; namespace build2 @@ -91,8 +94,11 @@ namespace build2 // may be unknown because we haven't matched the lib{} group // yet. So we postpone this for later (see match_postponed()). // - mlock l (postponed_.mutex); - postponed_.list.push_back (postponed_prerequisite {a, t, p,}); + const module& mod (*rs.find_module (module::name)); + + mlock l (mod.postponed.mutex); + mod.postponed.list.push_back ( + postponed_prerequisite {a, t, p, t.state[a].rule->first}); continue; } @@ -112,19 +118,23 @@ namespace build2 } void rule:: - match_postponed (action a, const target& t, const prerequisite& p) + match_postponed (const postponed_prerequisite& pp) { + action a (pp.action); + const target& t (pp.target); + const prerequisite& p (pp.prereq); + const prerequisite_key& k (p.key ()); const target* pt (k.tk.type->search (t, k)); if (pt == nullptr) { // Note that we do loose the diag frame that we normally get when - // failing during match. So let's mention the target manually. + // failing during match. So let's mention the target/rule manually. // fail << "prerequisite " << k << " is not existing source file nor " << "known output target" << - info << "while applying rule dist to " << diag_do (a, t); + info << "while applying rule " << pp.rule << " to " << diag_do (a, t); } search_custom (p, *pt); // Cache. -- cgit v1.1