aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-02-16 06:22:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-02-16 06:22:13 +0200
commitd9b34adbc5ae1e9e23cf3641c72fd302e8c7790c (patch)
treeba3625a8fa2de237ec47671479e24fc786b3e2c1 /libbuild2/file.cxx
parentbc2efe549c842d08f8253083e97f38f154907750 (diff)
Add pre/post hooks to load_root()
Diffstat (limited to 'libbuild2/file.cxx')
-rw-r--r--libbuild2/file.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index d91bf73..d789d20 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -1506,7 +1506,9 @@ namespace build2
}
void
- load_root (scope& root)
+ load_root (scope& root,
+ const function<void (parser&)>& pre,
+ const function<void (parser&)>& post)
{
tracer trace ("load_root");
@@ -1576,10 +1578,22 @@ namespace build2
//
parser p (ctx, load_stage::root);
+ if (pre != nullptr)
+ {
+ pre (p);
+ p.reset ();
+ }
+
if (he) {source_hooks (p, root, hd, true /* pre */); p.reset ();}
if (fe) {source_once (p, root, root, f, root);}
if (he) {p.reset (); source_hooks (p, root, hd, false /* pre */);}
+ if (post != nullptr)
+ {
+ p.reset ();
+ post (p);
+ }
+
// Finish off initializing bootstrapped modules (after mode).
//
{