use of com.facebook.buck.rules.Cell in project buck by facebook.
the class BuildFileSpecTest method findWithWatchmanThrowsOnFailure.
@Test
public void findWithWatchmanThrowsOnFailure() throws IOException, InterruptedException {
Path watchRoot = Paths.get(".").toAbsolutePath().normalize();
FakeProjectFilesystem filesystem = new FakeProjectFilesystem(watchRoot.resolve("project-name"));
Path buildFile = Paths.get("a", "BUCK");
BuildFileSpec recursiveSpec = BuildFileSpec.fromRecursivePath(buildFile.getParent(), filesystem.getRootPath());
FakeWatchmanClient fakeWatchmanClient = new FakeWatchmanClient(0, ImmutableMap.of(ImmutableList.of("query", watchRoot.toString(), ImmutableMap.of("relative_root", "project-name", "sync_timeout", 0, "path", ImmutableList.of("a"), "fields", ImmutableList.of("name"), "expression", ImmutableList.of("allof", "exists", ImmutableList.of("name", "BUCK"), ImmutableList.of("type", "f")))), ImmutableMap.of("files", ImmutableList.of("a/BUCK"))), new IOException("Whoopsie!"));
Cell cell = new TestCellBuilder().setFilesystem(filesystem).setWatchman(new Watchman(ImmutableMap.of(filesystem.getRootPath(), ProjectWatch.of(watchRoot.toString(), Optional.of("project-name"))), ImmutableSet.of(Watchman.Capability.SUPPORTS_PROJECT_WATCH, Watchman.Capability.DIRNAME, Watchman.Capability.WILDMATCH_GLOB), ImmutableMap.of(), Optional.of(Paths.get(".watchman-sock")), Optional.of(fakeWatchmanClient))).build();
thrown.expect(IOException.class);
thrown.expectMessage("Whoopsie!");
recursiveSpec.findBuildFiles(cell, ParserConfig.BuildFileSearchMethod.WATCHMAN);
}
use of com.facebook.buck.rules.Cell in project buck by facebook.
the class ParsePipelineTest method fetchGroup.
@Test
public void fetchGroup() throws Exception {
try (Fixture fixture = createSynchronousExecutionFixture("groups")) {
final Cell cell = fixture.getCell();
TargetGroup group = fixture.getTargetGroupParsePipeline().getNode(cell, BuildTargetFactory.newInstance(cell.getFilesystem(), "//:group_one"));
TargetNode<?, ?> node = fixture.getTargetNodeParsePipeline().getNode(cell, BuildTargetFactory.newInstance(cell.getFilesystem(), "//:foo"));
assertThat(group.containsTarget(node.getBuildTarget()), is(true));
}
}
use of com.facebook.buck.rules.Cell in project buck by facebook.
the class ParsePipelineTest method badDependency.
@Test
public void badDependency() throws Exception {
try (Fixture fixture = createMultiThreadedFixture("parse_rule_with_bad_dependency")) {
Cell cell = fixture.getCell();
fixture.getTargetNodeParsePipeline().getNode(cell, BuildTargetFactory.newInstance(cell.getFilesystem(), "//:base"));
}
}
use of com.facebook.buck.rules.Cell in project buck by facebook.
the class ParsePipelineTest method exceptionOnSwappedRawNodesInGetAllTargetNodes.
@Test
public void exceptionOnSwappedRawNodesInGetAllTargetNodes() throws Exception {
try (Fixture fixture = createSynchronousExecutionFixture("pipeline_test")) {
Cell cell = fixture.getCell();
Path rootBuildFilePath = cell.getFilesystem().resolve("BUCK");
Path aBuildFilePath = cell.getFilesystem().resolve("a/BUCK");
fixture.getTargetNodeParsePipeline().getAllNodes(cell, rootBuildFilePath);
Optional<ImmutableSet<Map<String, Object>>> rootRawNodes = fixture.getRawNodeParsePipelineCache().lookupComputedNode(cell, rootBuildFilePath);
fixture.getRawNodeParsePipelineCache().putComputedNodeIfNotPresent(cell, aBuildFilePath, rootRawNodes.get());
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage("Raw data claims to come from [], but we tried rooting it at [a].");
fixture.getTargetNodeParsePipeline().getAllNodes(cell, aBuildFilePath);
}
}
use of com.facebook.buck.rules.Cell in project buck by facebook.
the class ParsePipelineTest method speculativeDepsTraversal.
@Test
public void speculativeDepsTraversal() throws Exception {
final Fixture fixture = createMultiThreadedFixture("pipeline_test");
final Cell cell = fixture.getCell();
TargetNode<?, ?> libTargetNode = fixture.getTargetNodeParsePipeline().getNode(cell, BuildTargetFactory.newInstance(cell.getFilesystem(), "//:lib"));
waitForAll(libTargetNode.getDeps(), dep -> fixture.getTargetNodeParsePipelineCache().lookupComputedNode(cell, dep) != null);
fixture.close();
}
Aggregations