Search in sources :

Example 11 with TargetNodeTranslator

use of com.facebook.buck.versions.TargetNodeTranslator in project buck by facebook.

the class SourceListTest method translatedNamedSourcesTargets.

@Test
public void translatedNamedSourcesTargets() {
    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.ofNamedSources(ImmutableSortedMap.of("name", new DefaultBuildTargetSourcePath(target)))), Matchers.equalTo(Optional.of(SourceList.ofNamedSources(ImmutableSortedMap.of("name", 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 12 with TargetNodeTranslator

use of com.facebook.buck.versions.TargetNodeTranslator in project buck by facebook.

the class NeededCoverageSpecTest method untranslatedTargets.

@Test
public void untranslatedTargets() {
    BuildTarget target = BuildTargetFactory.newInstance("//:rule");
    TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of());
    NeededCoverageSpec spec = NeededCoverageSpec.of(1.0f, target, Optional.empty());
    assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, spec), Matchers.equalTo(Optional.empty()));
}
Also used : BuildTarget(com.facebook.buck.model.BuildTarget) FixedTargetNodeTranslator(com.facebook.buck.versions.FixedTargetNodeTranslator) TargetNodeTranslator(com.facebook.buck.versions.TargetNodeTranslator) FixedTargetNodeTranslator(com.facebook.buck.versions.FixedTargetNodeTranslator) Test(org.junit.Test)

Aggregations

BuildTarget (com.facebook.buck.model.BuildTarget)12 TargetNodeTranslator (com.facebook.buck.versions.TargetNodeTranslator)12 FixedTargetNodeTranslator (com.facebook.buck.versions.FixedTargetNodeTranslator)11 Test (org.junit.Test)11 DefaultBuildTargetSourcePath (com.facebook.buck.rules.DefaultBuildTargetSourcePath)5 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)1 BuildTargetPattern (com.facebook.buck.model.BuildTargetPattern)1 BuildTargets (com.facebook.buck.model.BuildTargets)1 Flavor (com.facebook.buck.model.Flavor)1 FlavorDomain (com.facebook.buck.model.FlavorDomain)1 Flavored (com.facebook.buck.model.Flavored)1 MacroException (com.facebook.buck.model.MacroException)1 MacroFinder (com.facebook.buck.model.MacroFinder)1 MacroReplacer (com.facebook.buck.model.MacroReplacer)1 BuildTargetParseException (com.facebook.buck.parser.BuildTargetParseException)1 BuildTargetParser (com.facebook.buck.parser.BuildTargetParser)1 BuildTargetPatternParser (com.facebook.buck.parser.BuildTargetPatternParser)1 NoSuchBuildTargetException (com.facebook.buck.parser.NoSuchBuildTargetException)1 BuildRule (com.facebook.buck.rules.BuildRule)1 BuildRuleParams (com.facebook.buck.rules.BuildRuleParams)1