use of com.facebook.buck.cxx.CxxGenrule in project buck by facebook.
the class PythonLibraryDescriptionTest method cxxGenruleSrcs.
@Test
public void cxxGenruleSrcs() throws Exception {
CxxGenruleBuilder srcBuilder = new CxxGenruleBuilder(BuildTargetFactory.newInstance("//:src")).setOut("out.py");
PythonLibraryBuilder libraryBuilder = new PythonLibraryBuilder(BuildTargetFactory.newInstance("//:lib")).setSrcs(SourceList.ofUnnamedSources(ImmutableSortedSet.of(new DefaultBuildTargetSourcePath(srcBuilder.getTarget()))));
TargetGraph targetGraph = TargetGraphFactory.newInstance(srcBuilder.build(), libraryBuilder.build());
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
CxxGenrule src = (CxxGenrule) resolver.requireRule(srcBuilder.getTarget());
PythonLibrary library = (PythonLibrary) resolver.requireRule(libraryBuilder.getTarget());
PythonPackageComponents components = library.getPythonPackageComponents(PythonTestUtils.PYTHON_PLATFORM, CxxPlatformUtils.DEFAULT_PLATFORM);
assertThat(components.getModules().values(), Matchers.contains(src.getGenrule(CxxPlatformUtils.DEFAULT_PLATFORM)));
}
Aggregations