From cb8399da1f0b1c5f28e443c98bfc3cb4e12b8cbf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 20 Jul 2015 17:35:47 +0200 Subject: 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. --- build/bin/rule.cxx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'build/bin/rule.cxx') diff --git a/build/bin/rule.cxx b/build/bin/rule.cxx index 0fc0e40..0eb8363 100644 --- a/build/bin/rule.cxx +++ b/build/bin/rule.cxx @@ -114,15 +114,25 @@ namespace build if (current_mode == execution_mode::last) swap (m1, m2); - target_state ts (target_state::unchanged); + target_state r (target_state::unchanged), ts; - if (m1 != nullptr && execute (a, *m1) == target_state::changed) - ts = target_state::changed; + if (m1 != nullptr) + { + ts = execute (a, *m1); + if (ts == target_state::changed || + (ts == target_state::postponed && r == target_state::unchanged)) + r = ts; + } - if (m2 != nullptr && execute (a, *m2) == target_state::changed) - ts = target_state::changed; + if (m2 != nullptr) + { + ts = execute (a, *m2); + if (ts == target_state::changed || + (ts == target_state::postponed && r == target_state::unchanged)) + r = ts; + } - return ts; + return r; } } } -- cgit v1.1