diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-18 13:50:58 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-18 13:50:58 +0200 |
commit | d402bc96297c6ed3dd6ee883dcff8cc39bd01030 (patch) | |
tree | 634d397f48022935926e26123c13ab8adad6796e /build2/algorithm | |
parent | 34be21a72a396240642acf3050eead875d3ed4b4 (diff) |
Ignore prerequisite mtimes that are not linker inputs
This makes sure, for example, that we don't unnecessarily re-link an
executable when its testscript prerequisite is changes.
Diffstat (limited to 'build2/algorithm')
-rw-r--r-- | build2/algorithm | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/build2/algorithm b/build2/algorithm index 9401915..3dbef4c 100644 --- a/build2/algorithm +++ b/build2/algorithm @@ -180,15 +180,31 @@ namespace build2 target_state reverse_execute_prerequisites (action, target&); - // A version of the above that also determines whether the action - // needs to be executed on the target based on the passed mtime - // timestamp. + // A version of the above that also determines whether the action needs to + // be executed on the target based on the passed timestamp and filter. // - // Note that because we use mtime, this function should normally - // only be used in the perform_update action. + // The filter is passed each prerequisite target and is expected to signal + // which ones should be used for timestamp comparison. If the filter is + // NULL, then all the prerequisites are used. // - bool - execute_prerequisites (action, target&, const timestamp&); + // Note that the return value is a pair with the second half indicating + // whether any prerequisites were updated. This is used to handle the + // situation where some prerequisites were updated but no update of the + // target is necessary. In this case we still signal that the target was + // (conceptually, but not physically) changed. This is important both to + // propagate the fact that some work has been done and to also allow our + // dependents to detect this case if they are up to something tricky (like + // recursively linking liba{} prerequisites). + // + // Note that because we use mtime, this function should normally only be + // used in the perform_update action. + // + using prerequisite_filter = function<bool (target&)>; + + pair<bool, target_state> + execute_prerequisites (action, target&, + const timestamp&, + const prerequisite_filter& = nullptr); // Another version of the above that does two extra things for the caller: // it determines whether the action needs to be executed on the target based @@ -198,17 +214,23 @@ namespace build2 // prerequisites of the same type may get injected). // template <typename T> - T* - execute_prerequisites (action, target&, const timestamp&); + pair<T*, target_state> + execute_prerequisites (action, target&, + const timestamp&, + const prerequisite_filter& = nullptr); - target* + pair<target*, target_state> execute_prerequisites (const target_type&, - action, target&, const timestamp&); + action, target&, + const timestamp&, + const prerequisite_filter& = nullptr); template <typename T> - T* + pair<T*, target_state> execute_prerequisites (const target_type&, - action, target&, const timestamp&); + action, target&, + const timestamp&, + const prerequisite_filter& = nullptr); // Return noop_recipe instead of using this function directly. // |