aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/dist/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-12-01 10:00:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-12-01 10:00:37 +0200
commitf8de93520fd604a3771a2af3ca9564f6085d8baa (patch)
treeed55bf099269efa3453943336c77ce236c2577a6 /libbuild2/dist/rule.cxx
parenta6f5ad72f4c751cd62566de227a7cbe89ff3af26 (diff)
Make dist::rule reusable as base
Diffstat (limited to 'libbuild2/dist/rule.cxx')
-rw-r--r--libbuild2/dist/rule.cxx20
1 files changed, 15 insertions, 5 deletions
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 <libbuild2/algorithm.hxx>
#include <libbuild2/diagnostics.hxx>
+#include <libbuild2/dist/types.hxx>
+#include <libbuild2/dist/module.hxx>
+
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> (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.