Search in sources :

Example 1 with CxxGenrule

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)));
}
Also used : CxxGenruleBuilder(com.facebook.buck.cxx.CxxGenruleBuilder) CxxGenrule(com.facebook.buck.cxx.CxxGenrule) TargetGraph(com.facebook.buck.rules.TargetGraph) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) DefaultBuildTargetSourcePath(com.facebook.buck.rules.DefaultBuildTargetSourcePath) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Test(org.junit.Test)

Aggregations

CxxGenrule (com.facebook.buck.cxx.CxxGenrule)1 CxxGenruleBuilder (com.facebook.buck.cxx.CxxGenruleBuilder)1 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)1 DefaultBuildTargetSourcePath (com.facebook.buck.rules.DefaultBuildTargetSourcePath)1 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)1 TargetGraph (com.facebook.buck.rules.TargetGraph)1 Test (org.junit.Test)1