aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-11-29 14:31:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-11-29 14:31:00 +0200
commitb1d778b2303c3dcb3f70e4b29a0a9bcba72c11d6 (patch)
treec300eebf51f2f72d37bfea48114ffcefedc61fc5 /build
parent15d7a706a5f6904a4f295b5cddd7cbd51b04e863 (diff)
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).
Diffstat (limited to 'build')
-rw-r--r--build/algorithm6
-rw-r--r--build/algorithm.cxx3
-rw-r--r--build/cli/module.cxx4
-rw-r--r--build/target16
-rw-r--r--build/target.ixx15
5 files changed, 27 insertions, 17 deletions
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<cxx::ixx> (perform_id, update_id, "cli", compile_);
rs.insert<cxx::ixx> (perform_id, clean_id, "cli", compile_);
-
- // We may need to resolve group members.
- //
- rs.insert<cli_cxx> (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 <typename T>
- inline void prerequisite_members_range<T>::iterator::
+ inline bool prerequisite_members_range<T>::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;
}
}