Search in sources :

Example 36 with DefaultBuildTargetSourcePath

use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.

the class SourceListTest method untranslatedUnnamedSourcesTargets.

@Test
public void untranslatedUnnamedSourcesTargets() {
    BuildTarget target = BuildTargetFactory.newInstance("//:rule");
    TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of());
    SourceList list = SourceList.ofUnnamedSources(ImmutableSortedSet.of(new DefaultBuildTargetSourcePath(target)));
    assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, list), Matchers.equalTo(Optional.empty()));
}
Also used : BuildTarget(com.facebook.buck.model.BuildTarget) FixedTargetNodeTranslator(com.facebook.buck.versions.FixedTargetNodeTranslator) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) TargetNodeTranslator(com.facebook.buck.versions.TargetNodeTranslator) FixedTargetNodeTranslator(com.facebook.buck.versions.FixedTargetNodeTranslator) Test(org.junit.Test)

Example 37 with DefaultBuildTargetSourcePath

use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.

the class SourceListTest method translatedUnnamedSourcesTargets.

@Test
public void translatedUnnamedSourcesTargets() {
    BuildTarget target = BuildTargetFactory.newInstance("//:rule");
    BuildTarget newTarget = BuildTargetFactory.newInstance("//something:else");
    TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of(target, newTarget));
    assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, SourceList.ofUnnamedSources(ImmutableSortedSet.of(new DefaultBuildTargetSourcePath(target)))), Matchers.equalTo(Optional.of(SourceList.ofUnnamedSources(ImmutableSortedSet.of(new DefaultBuildTargetSourcePath(newTarget))))));
}
Also used : BuildTarget(com.facebook.buck.model.BuildTarget) FixedTargetNodeTranslator(com.facebook.buck.versions.FixedTargetNodeTranslator) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) TargetNodeTranslator(com.facebook.buck.versions.TargetNodeTranslator) FixedTargetNodeTranslator(com.facebook.buck.versions.FixedTargetNodeTranslator) Test(org.junit.Test)

Example 38 with DefaultBuildTargetSourcePath

use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.

the class SourceListTest method untranslatedNamedSourcesTargets.

@Test
public void untranslatedNamedSourcesTargets() {
    BuildTarget target = BuildTargetFactory.newInstance("//:rule");
    TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of());
    SourceList list = SourceList.ofNamedSources(ImmutableSortedMap.of("name", new DefaultBuildTargetSourcePath(target)));
    assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, list), Matchers.equalTo(Optional.empty()));
}
Also used : BuildTarget(com.facebook.buck.model.BuildTarget) FixedTargetNodeTranslator(com.facebook.buck.versions.FixedTargetNodeTranslator) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) TargetNodeTranslator(com.facebook.buck.versions.TargetNodeTranslator) FixedTargetNodeTranslator(com.facebook.buck.versions.FixedTargetNodeTranslator) Test(org.junit.Test)

Example 39 with DefaultBuildTargetSourcePath

use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.

the class SourcePathTypeCoercerTest method coerceAbsoluteBuildTarget.

@Test
public void coerceAbsoluteBuildTarget() throws CoerceFailedException, IOException {
    SourcePath sourcePath = sourcePathTypeCoercer.coerce(cellRoots, projectFilesystem, pathRelativeToProjectRoot, "//:hello");
    assertEquals(new DefaultBuildTargetSourcePath(BuildTarget.of(UnflavoredBuildTarget.of(projectFilesystem.getRootPath(), Optional.empty(), "//", "hello"), ImmutableSortedSet.of())), sourcePath);
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) PathSourcePath(com.facebook.buck.rules.PathSourcePath) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) Test(org.junit.Test)

Example 40 with DefaultBuildTargetSourcePath

use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.

the class SourcePathTypeCoercerTest method coerceRelativeBuildTarget.

@Test
public void coerceRelativeBuildTarget() throws CoerceFailedException, IOException {
    SourcePath sourcePath = sourcePathTypeCoercer.coerce(cellRoots, projectFilesystem, pathRelativeToProjectRoot, ":hello");
    assertEquals(new DefaultBuildTargetSourcePath(BuildTarget.of(UnflavoredBuildTarget.of(projectFilesystem.getRootPath(), Optional.empty(), "//", "hello"), ImmutableSortedSet.of())), sourcePath);
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) PathSourcePath(com.facebook.buck.rules.PathSourcePath) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) Test(org.junit.Test)

Aggregations

DefaultBuildTargetSourcePath (com.facebook.buck.rules.DefaultBuildTargetSourcePath)71 Test (org.junit.Test)64 BuildTarget (com.facebook.buck.model.BuildTarget)53 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)26 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)25 SourcePath (com.facebook.buck.rules.SourcePath)25 PathSourcePath (com.facebook.buck.rules.PathSourcePath)22 FakeSourcePath (com.facebook.buck.rules.FakeSourcePath)21 TargetGraph (com.facebook.buck.rules.TargetGraph)19 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)18 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)18 Path (java.nio.file.Path)16 BuildRule (com.facebook.buck.rules.BuildRule)11 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)10 BuildRuleParams (com.facebook.buck.rules.BuildRuleParams)9 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)9 FakeBuildRule (com.facebook.buck.rules.FakeBuildRule)8 FrameworkPath (com.facebook.buck.rules.coercer.FrameworkPath)7 FakeBuildRuleParamsBuilder (com.facebook.buck.rules.FakeBuildRuleParamsBuilder)6 SourceTreePath (com.facebook.buck.apple.xcode.xcodeproj.SourceTreePath)5