aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/dist
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-19 10:26:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-19 10:26:22 +0200
commit18394bc05dc4cadb2dc193cfeb78598c70447869 (patch)
tree2b3d794305dc5d950f9c05094b80c89b93e5fd25 /libbuild2/dist
parentb408d19f614b47670cd0a0def501266f0d7689b5 (diff)
Add support for post hoc prerequisites
Unlike normal and ad hoc prerequisites, a post hoc prerequisite is built after the target, not before. It may also form a dependency cycle together with normal/ad hoc prerequisites. In other words, all this form of dependency guarantees is that a post hoc prerequisite will be built if its dependent target is built. See the NEWS file for details and an example.
Diffstat (limited to 'libbuild2/dist')
-rw-r--r--libbuild2/dist/operation.cxx30
-rw-r--r--libbuild2/dist/rule.cxx4
2 files changed, 20 insertions, 14 deletions
diff --git a/libbuild2/dist/operation.cxx b/libbuild2/dist/operation.cxx
index 91d2321..9a662df 100644
--- a/libbuild2/dist/operation.cxx
+++ b/libbuild2/dist/operation.cxx
@@ -85,7 +85,7 @@ namespace build2
if (auto* m = rs.find_module<module> (module::name))
m->distributed = true;
- load (vs, rs, bf, out_base, src_base, l);
+ perform_load (vs, rs, bf, out_base, src_base, l);
}
// Enter the specified source file as a target of type T. The path is
@@ -301,17 +301,17 @@ namespace build2
const operation_info* poif (ops[pid]);
ctx.current_operation (*poif, oif, false /* diag_noise */);
action a (dist_id, poif->id, oif->id);
- match (params, a, ts,
- 1 /* diag (failures only) */,
- false /* progress */);
+ perform_match (params, a, ts,
+ 1 /* diag (failures only) */,
+ false /* progress */);
}
}
ctx.current_operation (*oif, nullptr, false /* diag_noise */);
action a (dist_id, oif->id);
- match (params, a, ts,
- 1 /* diag (failures only) */,
- false /* progress */);
+ perform_match (params, a, ts,
+ 1 /* diag (failures only) */,
+ false /* progress */);
if (auto po = oif->post_operation)
{
@@ -320,9 +320,9 @@ namespace build2
const operation_info* poif (ops[pid]);
ctx.current_operation (*poif, oif, false /* diag_noise */);
action a (dist_id, poif->id, oif->id);
- match (params, a, ts,
- 1 /* diag (failures only) */,
- false /* progress */);
+ perform_match (params, a, ts,
+ 1 /* diag (failures only) */,
+ false /* progress */);
}
}
}
@@ -1092,6 +1092,8 @@ namespace build2
// given the prescribed semantics of adhoc (match/execute but otherwise
// ignore) is followed.
//
+ // Note that we don't need to do anything for posthoc.
+ //
if (i == include_type::excluded)
{
l5 ([&]{trace << "overriding exclusion of " << p;});
@@ -1116,11 +1118,11 @@ namespace build2
nullptr, // meta-operation pre
&dist_operation_pre,
&dist_load_load,
- &search, // normal search
- nullptr, // no match (see dist_execute()).
+ &perform_search, // normal search
+ nullptr, // no match (see dist_execute()).
&dist_load_execute,
- nullptr, // operation post
- nullptr, // meta-operation post
+ nullptr, // operation post
+ nullptr, // meta-operation post
&dist_include
};
diff --git a/libbuild2/dist/rule.cxx b/libbuild2/dist/rule.cxx
index ac3d440..e47f1f8 100644
--- a/libbuild2/dist/rule.cxx
+++ b/libbuild2/dist/rule.cxx
@@ -79,6 +79,10 @@ namespace build2
!p.dir.sub (out_root))
continue;
+ // @@ TODO: this can actually be order-dependent: for example
+ // libs{} prerequisite may be unknown because we haven't
+ // matched the lib{} group yet.
+ //
fail << "prerequisite " << k << " is not existing source file "
<< "nor known output target" << endf;
}