From b1d778b2303c3dcb3f70e4b29a0a9bcba72c11d6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 29 Nov 2015 14:31:00 +0200 Subject: Allow for target group members to remain unresolved This, for example, can happen when we have a fallback rule for dist(update) or configure(update). --- build/algorithm | 6 ++++-- build/algorithm.cxx | 3 +-- build/cli/module.cxx | 4 ---- build/target | 16 ++++++++++------ build/target.ixx | 15 ++++++++++++--- 5 files changed, 27 insertions(+), 17 deletions(-) (limited to 'build') diff --git a/build/algorithm b/build/algorithm index 375cebb..d144d6c 100644 --- a/build/algorithm +++ b/build/algorithm @@ -121,8 +121,10 @@ namespace build void search_and_match_prerequisite_members (action, target&, const dir_path&); - // Unless already available, match, and, if necessary, execute - // the group in order to obtain its members list. + // Unless already available, match, and, if necessary, execute the group + // in order to obtain its members list. Note that even after that the + // member's list might still not be available (e.g., if some wildcard/ + // fallback rule matched). // group_view resolve_group_members (action, target&); diff --git a/build/algorithm.cxx b/build/algorithm.cxx index fb6c72a..6c3374e 100644 --- a/build/algorithm.cxx +++ b/build/algorithm.cxx @@ -272,8 +272,7 @@ namespace build execute_direct (a, g); r = g.group_members (a); - assert (r.members != nullptr); // What "next step" did the group expect? - return r; + return r; // Might still be unresolved. } void diff --git a/build/cli/module.cxx b/build/cli/module.cxx index 240aaa7..05abb94 100644 --- a/build/cli/module.cxx +++ b/build/cli/module.cxx @@ -72,10 +72,6 @@ namespace build rs.insert (perform_id, update_id, "cli", compile_); rs.insert (perform_id, clean_id, "cli", compile_); - - // We may need to resolve group members. - // - rs.insert (configure_id, update_id, "cli", compile_); } // Enter module variables. diff --git a/build/target b/build/target index f2b093e..d451851 100644 --- a/build/target +++ b/build/target @@ -609,14 +609,18 @@ namespace build g_.count = 1; } - // Iterate over this group's members. Similar to leave_group(), - // you should increment the iterator after calling this function. + // Iterate over this group's members. Return false if the member + // information is not available. Similar to leave_group(), you + // should increment the iterator after calling this function + // (provided it returned true). // - void + bool enter_group () { - switch_members (); - --j_; // Compensate for the increment that will follow. + bool r (switch_members ()); + if (r) + --j_; // Compensate for the increment that will follow. + return r; } value_type operator* () const @@ -646,7 +650,7 @@ namespace build operator!= (const iterator& x, const iterator& y) {return !(x == y);} private: - void + bool switch_members (); private: diff --git a/build/target.ixx b/build/target.ixx index 3ae9660..3d48904 100644 --- a/build/target.ixx +++ b/build/target.ixx @@ -57,17 +57,26 @@ namespace build } template - inline void prerequisite_members_range::iterator:: + inline bool prerequisite_members_range::iterator:: switch_members () { - j_ = 1; - do { g_ = resolve_group_members (r_->a_, search (*i_)); + + // If members are not know, iterate over the group as itself. + // + if (g_.members == nullptr) + { + g_.count = 0; + return false; + } } while (g_.count == 0 && // Skip empty groups. ++i_ != r_->e_ && i_->get ().type.see_through); + + j_ = 1; // Start from the first group member. + return true; } } -- cgit v1.1