Add a helper staticmethod `closure()` to `BuildGraph`.

Review Request #3160 — Created Nov. 21, 2015 and submitted — Latest diff uploaded

2602, 2605
jsirois, stuhood, zundel
Add a helper staticmethod `closure()` to `BuildGraph`.

BuildGraph.closure() emulates Target.closure() but instead accepts a (potentially empty) iterable of
targets and computes their closure all at once using the efficient implementations in BuildGraph.

BuildGraph.closure() will delegate to the appropriate bfs vs dfs implementation on BuildGraph based on
the passed bfs parameter (defaults to False). It will not pass through predicates or postorder when
in dfs mode.

Because of the peeking at Target._build_graph, which is private, this isn't an ideal long-term solution--
but it's a compromise between repeating the same tricky code (which is dangerous) and repeating the same
ugly code (which is error and cargo-cult prone).

CI is green: