use of com.facebook.buck.rules.FakeCellPathResolver in project buck by facebook.
the class BuildTargetParserTest method testParseWithRepoName.
@Test
public void testParseWithRepoName() {
final Path localRepoRoot = Paths.get("/opt/local/repo");
CellPathResolver cellRoots = new FakeCellPathResolver(ImmutableMap.of("localreponame", localRepoRoot));
String targetStr = "localreponame//foo/bar:baz";
BuildTarget buildTarget = parser.parse(targetStr, fullyQualifiedParser, cellRoots);
assertEquals("localreponame//foo/bar:baz", buildTarget.getFullyQualifiedName());
assertTrue(buildTarget.getCell().isPresent());
assertEquals(localRepoRoot, buildTarget.getCellPath());
}
use of com.facebook.buck.rules.FakeCellPathResolver in project buck by facebook.
the class BuildTargetPatternParserTest method visibilityCanContainCrossCellReference.
@Test
public void visibilityCanContainCrossCellReference() {
BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser = BuildTargetPatternParser.forVisibilityArgument();
final ProjectFilesystem filesystem = FakeProjectFilesystem.createJavaOnlyFilesystem();
CellPathResolver cellNames = new FakeCellPathResolver(ImmutableMap.of("other", filesystem.getRootPath()));
assertEquals(new SingletonBuildTargetPattern(filesystem.getRootPath(), "//:something"), buildTargetPatternParser.parse(cellNames, "other//:something"));
assertEquals(new SubdirectoryBuildTargetPattern(filesystem.getRootPath(), filesystem.getPath("sub")), buildTargetPatternParser.parse(cellNames, "other//sub/..."));
}
use of com.facebook.buck.rules.FakeCellPathResolver in project buck by facebook.
the class SourcePathTypeCoercerTest method coerceCrossRepoBuildTarget.
@Test
public void coerceCrossRepoBuildTarget() throws CoerceFailedException, IOException {
Path helloRoot = Paths.get("/opt/src/hello");
cellRoots = new FakeCellPathResolver(projectFilesystem, ImmutableMap.of("hello", helloRoot));
SourcePath sourcePath = sourcePathTypeCoercer.coerce(cellRoots, projectFilesystem, pathRelativeToProjectRoot, "hello//:hello");
// Note that the important thing is that the root of the target has been set to `helloRoot` so
// the cell name should be absent (otherwise, we'd look for a cell named `@hello` from the
// `@hello` cell. Yeah. My head hurts a little too.
assertEquals(new DefaultBuildTargetSourcePath(BuildTarget.of(UnflavoredBuildTarget.of(helloRoot, Optional.of("hello"), "//", "hello"), ImmutableSortedSet.of())), sourcePath);
}
use of com.facebook.buck.rules.FakeCellPathResolver in project buck by facebook.
the class SourcePathTypeCoercerTest method setUp.
@Before
public void setUp() {
projectFilesystem = new FakeProjectFilesystem();
cellRoots = new FakeCellPathResolver(projectFilesystem);
}
Aggregations