use of com.facebook.buck.graph.AbstractBottomUpTraversal in project buck by facebook.
the class ProjectGeneratorTest method getBuildRuleResolverNodeFunction.
private Function<TargetNode<?, ?>, BuildRuleResolver> getBuildRuleResolverNodeFunction(final TargetGraph targetGraph) {
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
AbstractBottomUpTraversal<TargetNode<?, ?>, RuntimeException> bottomUpTraversal = new AbstractBottomUpTraversal<TargetNode<?, ?>, RuntimeException>(targetGraph) {
@Override
@SuppressWarnings("PMD.EmptyCatchBlock")
public void visit(TargetNode<?, ?> node) {
try {
resolver.requireRule(node.getBuildTarget());
} catch (Exception e) {
// NOTE(agallagher): A large number of the tests appear to setup their target nodes
// incorrectly, causing action graph creation to fail with lots of missing expected
// Apple C/C++ platform flavors. This is gross, but to support tests that need a
// complete sub-action graph, just skip over the errors.
}
}
};
bottomUpTraversal.traverse();
return input -> resolver;
}
use of com.facebook.buck.graph.AbstractBottomUpTraversal in project buck by facebook.
the class ActionGraphCache method createActionGraph.
private static ActionGraphAndResolver createActionGraph(final BuckEventBus eventBus, TargetNodeToBuildRuleTransformer transformer, TargetGraph targetGraph) {
final BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, transformer, eventBus);
AbstractBottomUpTraversal<TargetNode<?, ?>, RuntimeException> bottomUpTraversal = new AbstractBottomUpTraversal<TargetNode<?, ?>, RuntimeException>(targetGraph) {
@Override
public void visit(TargetNode<?, ?> node) {
try {
resolver.requireRule(node.getBuildTarget());
} catch (NoSuchBuildTargetException e) {
throw new HumanReadableException(e);
}
}
};
bottomUpTraversal.traverse();
return ActionGraphAndResolver.builder().setActionGraph(new ActionGraph(resolver.getBuildRules())).setResolver(resolver).build();
}
Aggregations