aboutsummaryrefslogtreecommitdiff
path: root/build/algorithm.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-20 17:35:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-20 17:35:47 +0200
commitcb8399da1f0b1c5f28e443c98bfc3cb4e12b8cbf (patch)
tree434f2137e8ccac53bf6ec8a62bab501363d898f4 /build/algorithm.cxx
parentf0aca8db08518ab7f66a8c86200616fed8bcc8d4 (diff)
Implement pre/post operation support
Also, extend execution mode/postponed logic to propagate the postponed target state. At the top, we now re-try postponed targets. This results in the expected behavior when, for example, cleaning two targets with one depending on the other.
Diffstat (limited to 'build/algorithm.cxx')
-rw-r--r--build/algorithm.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/build/algorithm.cxx b/build/algorithm.cxx
index 83a6510..290bfa5 100644
--- a/build/algorithm.cxx
+++ b/build/algorithm.cxx
@@ -339,35 +339,39 @@ namespace build
target_state
execute_prerequisites (action a, target& t)
{
- target_state ts (target_state::unchanged);
+ target_state r (target_state::unchanged);
for (target* pt: t.prerequisite_targets)
{
if (pt == nullptr) // Skipped.
continue;
- if (execute (a, *pt) == target_state::changed)
- ts = target_state::changed;
+ target_state ts (execute (a, *pt));
+ if (ts == target_state::changed ||
+ (ts == target_state::postponed && r == target_state::unchanged))
+ r = ts;
}
- return ts;
+ return r;
}
target_state
reverse_execute_prerequisites (action a, target& t)
{
- target_state ts (target_state::unchanged);
+ target_state r (target_state::unchanged);
for (target* pt: reverse_iterate (t.prerequisite_targets))
{
if (pt == nullptr) // Skipped.
continue;
- if (execute (a, *pt) == target_state::changed)
- ts = target_state::changed;
+ target_state ts (execute (a, *pt));
+ if (ts == target_state::changed ||
+ (ts == target_state::postponed && r == target_state::unchanged))
+ r = ts;
}
- return ts;
+ return r;
}
bool