From 378b2598a305d4e332e52460ca89dd867546a58b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 7 Feb 2018 10:00:46 +0200 Subject: Initial work for default update outer operation While update still uses the old "all update rules update all their prerequisites" assumption, test and install have been fixed not to rely on this. --- build2/rule.cxx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'build2/rule.cxx') diff --git a/build2/rule.cxx b/build2/rule.cxx index ef1d3a4..e215846 100644 --- a/build2/rule.cxx +++ b/build2/rule.cxx @@ -98,6 +98,11 @@ namespace build2 recipe file_rule:: apply (action a, target& t) const { + /* + @@ outer + return noop_recipe; + */ + // Update triggers the update of this target's prerequisites so it would // seem natural that we should also trigger their cleanup. However, this // possibility is rather theoretical so until we see a real use-case for @@ -220,6 +225,8 @@ namespace build2 // First update prerequisites (e.g. create parent directories) then create // this directory. // + // @@ outer: should we assume for simplicity its only prereqs are fsdir{}? + // if (!t.prerequisite_targets[a].empty ()) ts = straight_execute_prerequisites (a, t); @@ -232,6 +239,8 @@ namespace build2 // better performance by first checking if it indeed exists. See // butl::try_mkdir() for details. // + // @@ Also skip prerequisites? Can't we return noop in apply? + // if (!exists (d) && fsdir_mkdir (t, d)) ts |= target_state::changed; @@ -280,7 +289,19 @@ namespace build2 const fsdir_rule fsdir_rule::instance; - // fallback_rule + // noop_rule // - const fallback_rule fallback_rule::instance; + bool noop_rule:: + match (action, target&, const string&) const + { + return true; + } + + recipe noop_rule:: + apply (action, target&) const + { + return noop_recipe; + } + + const noop_rule noop_rule::instance; } -- cgit v1.1