import com.intellij.util.graph.DFSTBuilder; //導入方法依賴的package包/類
private synchronized void initializeChunks(@NotNull CompileContext context) {
if (myTargetChunks != null) {
return;
}
final List extends BuildTarget>> allTargets = getAllTargets();
TargetOutputIndex outputIndex = new TargetOutputIndexImpl(allTargets, context);
for (BuildTarget> target : allTargets) {
myDependencies.put(target, target.computeDependencies(this, outputIndex));
}
GraphGenerator>
graph = GraphGenerator.create(CachingSemiGraph.create(new GraphGenerator.SemiGraph>() {
@Override
public Collection> getNodes() {
return myAllTargets;
}
@Override
public Iterator> getIn(BuildTarget> n) {
return myDependencies.get(n).iterator();
}
}));
final DFSTBuilder> builder = new DFSTBuilder>(graph);
final TIntArrayList sccs = builder.getSCCs();
myTargetChunks = new ArrayList(sccs.size());
sccs.forEach(new TIntProcedure() {
int myTNumber = 0;
public boolean execute(int size) {
final Set> chunkNodes = new LinkedHashSet>();
for (int j = 0; j final BuildTarget> node = builder.getNodeByTNumber(myTNumber + j);
chunkNodes.add(node);
}
myTargetChunks.add(new BuildTargetChunk(chunkNodes));
myTNumber += size;
return true;
}
});
}