use of com.facebook.buck.versions.TargetNodeTranslator in project buck by facebook.
the class CxxGenruleDescription method translateConstructorArg.
@Override
public Optional<Arg> translateConstructorArg(BuildTarget target, CellPathResolver cellNames, TargetNodeTranslator translator, Arg constructorArg) {
Arg newConstructorArg = createUnpopulatedConstructorArg();
translator.translateConstructorArg(cellNames, BuildTargetPatternParser.forBaseName(target.getBaseName()), constructorArg, newConstructorArg);
newConstructorArg.cmd = newConstructorArg.cmd.map(c -> translateCmd(target, cellNames, translator, "cmd", c));
newConstructorArg.bash = newConstructorArg.bash.map(c -> translateCmd(target, cellNames, translator, "bash", c));
newConstructorArg.cmdExe = newConstructorArg.cmdExe.map(c -> translateCmd(target, cellNames, translator, "cmd_exe", c));
return Optional.of(newConstructorArg);
}
use of com.facebook.buck.versions.TargetNodeTranslator in project buck by facebook.
the class NeededCoverageSpecTest method translatedTargets.
@Test
public void translatedTargets() {
BuildTarget target = BuildTargetFactory.newInstance("//:rule");
BuildTarget newTarget = BuildTargetFactory.newInstance("//something:else");
TargetNodeTranslator translator = new FixedTargetNodeTranslator(ImmutableMap.of(target, newTarget));
NeededCoverageSpec spec = NeededCoverageSpec.of(1.0f, target, Optional.empty());
assertThat(translator.translate(CELL_PATH_RESOLVER, PATTERN, spec), Matchers.equalTo(Optional.of(spec.withBuildTarget(newTarget))));
}
use of com.facebook.buck.versions.TargetNodeTranslator 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()));
}
use of com.facebook.buck.versions.TargetNodeTranslator 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))))));
}
use of com.facebook.buck.versions.TargetNodeTranslator 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()));
}
Aggregations