use of com.facebook.buck.versions.VersionPropagatorBuilder in project buck by facebook.
the class CxxGenruleDescriptionTest method versionedTargetReferenceIsTranslatedInVersionedGraph.
@Test
public void versionedTargetReferenceIsTranslatedInVersionedGraph() throws Exception {
VersionPropagatorBuilder dep = new VersionPropagatorBuilder("//:dep");
VersionedAliasBuilder versionedDep = new VersionedAliasBuilder("//:versioned").setVersions("1.0", "//:dep");
CxxGenruleBuilder genruleBuilder = new CxxGenruleBuilder(BuildTargetFactory.newInstance("//:genrule")).setCmd("$(ldflags-shared //:versioned)");
TargetGraph graph = TargetGraphFactory.newInstance(dep.build(), versionedDep.build(), genruleBuilder.build());
TargetGraphAndBuildTargets transformed = VersionedTargetGraphBuilder.transform(new NaiveVersionSelector(), TargetGraphAndBuildTargets.of(graph, ImmutableSet.of(genruleBuilder.getTarget())), POOL);
CxxGenruleDescription.Arg arg = extractArg(transformed.getTargetGraph().get(genruleBuilder.getTarget()), CxxGenruleDescription.Arg.class);
assertThat(arg.cmd, OptionalMatchers.present(Matchers.equalTo("$(ldflags-shared //:dep)")));
}
use of com.facebook.buck.versions.VersionPropagatorBuilder in project buck by facebook.
the class CxxGenruleDescriptionTest method versionPropagatorTargetReferenceIsTranslatedInVersionedGraph.
@Test
public void versionPropagatorTargetReferenceIsTranslatedInVersionedGraph() throws Exception {
VersionPropagatorBuilder transitiveDep = new VersionPropagatorBuilder("//:transitive_dep");
VersionedAliasBuilder versionedDep = new VersionedAliasBuilder("//:versioned").setVersions("1.0", "//:transitive_dep");
VersionPropagatorBuilder dep = new VersionPropagatorBuilder("//:dep").setDeps("//:versioned");
CxxGenruleBuilder genruleBuilder = new CxxGenruleBuilder(BuildTargetFactory.newInstance("//:genrule")).setCmd("$(ldflags-shared //:dep)");
TargetGraph graph = TargetGraphFactory.newInstance(transitiveDep.build(), versionedDep.build(), dep.build(), genruleBuilder.build());
TargetGraphAndBuildTargets transformed = VersionedTargetGraphBuilder.transform(new NaiveVersionSelector(), TargetGraphAndBuildTargets.of(graph, ImmutableSet.of(genruleBuilder.getTarget())), POOL);
CxxGenruleDescription.Arg arg = extractArg(transformed.getTargetGraph().get(genruleBuilder.getTarget()), CxxGenruleDescription.Arg.class);
assertThat(arg.cmd, OptionalMatchers.present(Matchers.matchesPattern(Pattern.quote("$(ldflags-shared //:dep#v") + "[a-zA-Z0-9]*" + Pattern.quote(")"))));
}
Aggregations