use of com.facebook.buck.jvm.java.JavaLibraryBuilder in project buck by facebook.
the class ActionGraphCacheTest method createTargetNode.
private TargetNode<?, ?> createTargetNode(String name, TargetNode<?, ?>... deps) {
BuildTarget buildTarget = BuildTargetFactory.newInstance("//foo:" + name);
JavaLibraryBuilder targetNodeBuilder = JavaLibraryBuilder.createBuilder(buildTarget);
for (TargetNode<?, ?> dep : deps) {
targetNodeBuilder.addDep(dep.getBuildTarget());
}
return targetNodeBuilder.build();
}
use of com.facebook.buck.jvm.java.JavaLibraryBuilder in project buck by facebook.
the class BuildRuleResolverTest method testRequireExistingBuildRule.
@Test
public void testRequireExistingBuildRule() throws Exception {
BuildTarget target = BuildTargetFactory.newInstance("//foo:bar");
JavaLibraryBuilder builder = JavaLibraryBuilder.createBuilder(target);
TargetNode<?, ?> library = builder.build();
TargetGraph targetGraph = TargetGraphFactory.newInstance(library);
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
BuildRule existing = builder.build(resolver);
assertThat(resolver.getRuleOptional(target).isPresent(), is(true));
BuildRule rule = resolver.requireRule(target);
assertThat(rule, is(notNullValue()));
assertThat(rule.getBuildTarget(), is(equalTo(target)));
assertThat(rule, is(equalTo(existing)));
}
use of com.facebook.buck.jvm.java.JavaLibraryBuilder in project buck by facebook.
the class VersionedTargetGraphTest method createTargetNode.
private TargetNode<?, ?> createTargetNode(String name, TargetNode<?, ?>... deps) {
BuildTarget buildTarget = BuildTargetFactory.newInstance("//foo:" + name);
JavaLibraryBuilder targetNodeBuilder = JavaLibraryBuilder.createBuilder(buildTarget);
// Use the selected versions field to embed the original build target name. We'll use this to
// verify the correct node was recovered from the target graph.
targetNodeBuilder.setSelectedVersions(ImmutableMap.of(buildTarget, Version.of("1.0")));
for (TargetNode<?, ?> dep : deps) {
targetNodeBuilder.addDep(dep.getBuildTarget());
}
return targetNodeBuilder.build();
}
Aggregations