aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-20 14:39:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-20 14:39:47 +0200
commit024161a19edd411ae249ec5fec503aff2409bc67 (patch)
tree3d38156a238c11a81214c2e220781ccf7eecf62f
parent0898e65ca37686a0a06a2980acf8cc40c0e2494e (diff)
Match inner update rule before prerequisites in install::file_rule
-rw-r--r--build2/install/rule.cxx21
1 files changed, 13 insertions, 8 deletions
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index 58182cb..266f873 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -292,6 +292,16 @@ namespace build2
// In both cases, the next step is to search, match, and collect all the
// installable prerequisites.
//
+ // But first, in case of the update pre-operation, match the inner rule
+ // (actual update). We used to do this after matching the prerequisites
+ // but the inner rule may provide some rule-specific information (like
+ // the target extension for exe{}) that may be required during the
+ // prerequisite search (like the base name for in{}).
+ //
+ optional<bool> unchanged;
+ if (a.operation () == update_id)
+ unchanged = match_inner (a, t, unmatch::unchanged);
+
auto& pts (t.prerequisite_targets[a]);
auto pms (group_prerequisite_members (a, t, members_mode::never));
@@ -346,14 +356,9 @@ namespace build2
if (a.operation () == update_id)
{
- // For the update pre-operation match the inner rule (actual update).
- //
- if (match_inner (a, t, unmatch::unchanged))
- {
- return pts.empty () ? noop_recipe : default_recipe;
- }
-
- return &perform_update;
+ return *unchanged
+ ? (pts.empty () ? noop_recipe : default_recipe)
+ : &perform_update;
}
else
{