diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/cli/module.cxx | 6 | ||||
-rw-r--r-- | build/dist/rule.cxx | 10 | ||||
-rw-r--r-- | build/target | 33 | ||||
-rw-r--r-- | build/target.ixx | 7 |
4 files changed, 39 insertions, 17 deletions
diff --git a/build/cli/module.cxx b/build/cli/module.cxx index 05abb94..64e95a8 100644 --- a/build/cli/module.cxx +++ b/build/cli/module.cxx @@ -72,6 +72,12 @@ namespace build rs.insert<cxx::ixx> (perform_id, update_id, "cli", compile_); rs.insert<cxx::ixx> (perform_id, clean_id, "cli", compile_); + + // Other rules (e.g., cxx::compile) may need to have the group + // members resolved. Looks like a general pattern: groups should + // resolve on configure(update). + // + rs.insert<cli_cxx> (configure_id, update_id, "cli", compile_); } // Enter module variables. diff --git a/build/dist/rule.cxx b/build/dist/rule.cxx index b5e1185..80e7b05 100644 --- a/build/dist/rule.cxx +++ b/build/dist/rule.cxx @@ -26,13 +26,21 @@ namespace build { const dir_path& out_root (t.root_scope ().out_path ()); - for (prerequisite_member p: group_prerequisite_members (a, t)) + auto r (group_prerequisite_members (a, t, false)); + for (auto i (r.begin ()); i != r.end (); ++i) { + prerequisite_member p (*i); + // Skip prerequisites imported from other projects. // if (p.proj () != nullptr) continue; + // If we can, go inside see-through groups. + // + if (p.type ().see_through && i.enter_group ()) + continue; + target& pt (p.search ()); // Don't match targets that are outside of our project. diff --git a/build/target b/build/target index d451851..d4a4bef 100644 --- a/build/target +++ b/build/target @@ -563,17 +563,17 @@ namespace build template <typename T> inline prerequisite_members_range<T> - prerequisite_members (action a, T&& x) + prerequisite_members (action a, T&& x, bool members = true) { - return prerequisite_members_range<T> (a, std::forward<T> (x)); + return prerequisite_members_range<T> (a, std::forward<T> (x), members); } template <typename T> class prerequisite_members_range { public: - prerequisite_members_range (action a, T&& r) - : a_ (a), r_ (std::forward<T> (r)), e_ (r_.end ()) {} + prerequisite_members_range (action a, T&& r, bool m) + : a_ (a), members_ (m), r_ (std::forward<T> (r)), e_ (r_.end ()) {} using base_iterator = decltype (std::declval<T> ().begin ()); @@ -589,8 +589,11 @@ namespace build iterator (const prerequisite_members_range* r, const base_iterator& i) : r_ (r), i_ (i), g_ {nullptr, 0} { - if (i_ != r_->e_ && i_->get ().type.see_through) - switch_members (); + if (r_->members_ && i_ != r_->e_ && i_->get ().type.see_through) + { + bool r (switch_members ()); + assert (r); // Group could not be resolved. + } } iterator& operator++ (); @@ -670,6 +673,7 @@ namespace build private: action a_; + bool members_; // Go into group members by default? T r_; base_iterator e_; }; @@ -677,34 +681,35 @@ namespace build // prerequisite_members(t.prerequisites) // inline auto - prerequisite_members (action a, target& t) + prerequisite_members (action a, target& t, bool members = true) { - return prerequisite_members (a, t.prerequisites); + return prerequisite_members (a, t.prerequisites, members); } // prerequisite_members(reverse_iterate(t.prerequisites)) // inline auto - reverse_prerequisite_members (action a, target& t) + reverse_prerequisite_members (action a, target& t, bool members = true) { - return prerequisite_members (a, butl::reverse_iterate (t.prerequisites)); + return prerequisite_members ( + a, butl::reverse_iterate (t.prerequisites), members); } // prerequisite_members(group_prerequisites (t)) // inline auto - group_prerequisite_members (action a, target& t) + group_prerequisite_members (action a, target& t, bool members = true) { - return prerequisite_members (a, group_prerequisites (t)); + return prerequisite_members (a, group_prerequisites (t), members); } // prerequisite_members(reverse_iterate (group_prerequisites (t))) // inline auto - reverse_group_prerequisite_members (action a, target& t) + reverse_group_prerequisite_members (action a, target& t, bool members = true) { return prerequisite_members ( - a, butl::reverse_iterate (group_prerequisites (t))); + a, butl::reverse_iterate (group_prerequisites (t)), members); } // diff --git a/build/target.ixx b/build/target.ixx index 3d48904..6bcd265 100644 --- a/build/target.ixx +++ b/build/target.ixx @@ -50,8 +50,11 @@ namespace build // Switch to member iteration mode. // - if (i_ != r_->e_ && i_->get ().type.see_through) - switch_members (); + if (r_->members_ && i_ != r_->e_ && i_->get ().type.see_through) + { + bool r (switch_members ()); + assert (r); // Group could not be resolved. + } return *this; } |