Search in sources :

Example 1 with SingletonBuildTargetPattern

use of com.facebook.buck.model.SingletonBuildTargetPattern in project buck by facebook.

the class BuildTargetPatternParserTest method testParse.

@Test
public void testParse() throws NoSuchBuildTargetException {
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser = BuildTargetPatternParser.forVisibilityArgument();
    assertEquals(new ImmediateDirectoryBuildTargetPattern(filesystem.getRootPath(), vfs.getPath("test/com/facebook/buck/parser/")), buildTargetPatternParser.parse(createCellRoots(filesystem), "//test/com/facebook/buck/parser:"));
    assertEquals(new SingletonBuildTargetPattern(filesystem.getRootPath(), "//test/com/facebook/buck/parser:parser"), buildTargetPatternParser.parse(createCellRoots(filesystem), "//test/com/facebook/buck/parser:parser"));
    assertEquals(new SubdirectoryBuildTargetPattern(filesystem.getRootPath(), vfs.getPath("test/com/facebook/buck/parser/")), buildTargetPatternParser.parse(createCellRoots(filesystem), "//test/com/facebook/buck/parser/..."));
}
Also used : SubdirectoryBuildTargetPattern(com.facebook.buck.model.SubdirectoryBuildTargetPattern) ImmediateDirectoryBuildTargetPattern(com.facebook.buck.model.ImmediateDirectoryBuildTargetPattern) BuildTargetPattern(com.facebook.buck.model.BuildTargetPattern) SingletonBuildTargetPattern(com.facebook.buck.model.SingletonBuildTargetPattern) ImmediateDirectoryBuildTargetPattern(com.facebook.buck.model.ImmediateDirectoryBuildTargetPattern) SingletonBuildTargetPattern(com.facebook.buck.model.SingletonBuildTargetPattern) SubdirectoryBuildTargetPattern(com.facebook.buck.model.SubdirectoryBuildTargetPattern) Test(org.junit.Test)

Example 2 with SingletonBuildTargetPattern

use of com.facebook.buck.model.SingletonBuildTargetPattern 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/..."));
}
Also used : SubdirectoryBuildTargetPattern(com.facebook.buck.model.SubdirectoryBuildTargetPattern) ImmediateDirectoryBuildTargetPattern(com.facebook.buck.model.ImmediateDirectoryBuildTargetPattern) BuildTargetPattern(com.facebook.buck.model.BuildTargetPattern) SingletonBuildTargetPattern(com.facebook.buck.model.SingletonBuildTargetPattern) SingletonBuildTargetPattern(com.facebook.buck.model.SingletonBuildTargetPattern) FakeCellPathResolver(com.facebook.buck.rules.FakeCellPathResolver) SubdirectoryBuildTargetPattern(com.facebook.buck.model.SubdirectoryBuildTargetPattern) CellPathResolver(com.facebook.buck.rules.CellPathResolver) FakeCellPathResolver(com.facebook.buck.rules.FakeCellPathResolver) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) Test(org.junit.Test)

Example 3 with SingletonBuildTargetPattern

use of com.facebook.buck.model.SingletonBuildTargetPattern in project buck by facebook.

the class BuildTargetPatternParserTest method testParseRootPattern.

@Test
public void testParseRootPattern() throws NoSuchBuildTargetException {
    BuildTargetPatternParser<BuildTargetPattern> buildTargetPatternParser = BuildTargetPatternParser.forVisibilityArgument();
    assertEquals(new ImmediateDirectoryBuildTargetPattern(filesystem.getRootPath(), vfs.getPath("")), buildTargetPatternParser.parse(createCellRoots(filesystem), "//:"));
    assertEquals(new SingletonBuildTargetPattern(filesystem.getRootPath(), "//:parser"), buildTargetPatternParser.parse(createCellRoots(filesystem), "//:parser"));
    assertEquals(new SubdirectoryBuildTargetPattern(filesystem.getRootPath(), vfs.getPath("")), buildTargetPatternParser.parse(createCellRoots(filesystem), "//..."));
}
Also used : SubdirectoryBuildTargetPattern(com.facebook.buck.model.SubdirectoryBuildTargetPattern) ImmediateDirectoryBuildTargetPattern(com.facebook.buck.model.ImmediateDirectoryBuildTargetPattern) BuildTargetPattern(com.facebook.buck.model.BuildTargetPattern) SingletonBuildTargetPattern(com.facebook.buck.model.SingletonBuildTargetPattern) ImmediateDirectoryBuildTargetPattern(com.facebook.buck.model.ImmediateDirectoryBuildTargetPattern) SingletonBuildTargetPattern(com.facebook.buck.model.SingletonBuildTargetPattern) SubdirectoryBuildTargetPattern(com.facebook.buck.model.SubdirectoryBuildTargetPattern) Test(org.junit.Test)

Aggregations

BuildTargetPattern (com.facebook.buck.model.BuildTargetPattern)3 ImmediateDirectoryBuildTargetPattern (com.facebook.buck.model.ImmediateDirectoryBuildTargetPattern)3 SingletonBuildTargetPattern (com.facebook.buck.model.SingletonBuildTargetPattern)3 SubdirectoryBuildTargetPattern (com.facebook.buck.model.SubdirectoryBuildTargetPattern)3 Test (org.junit.Test)3 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)1 CellPathResolver (com.facebook.buck.rules.CellPathResolver)1 FakeCellPathResolver (com.facebook.buck.rules.FakeCellPathResolver)1 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)1