Search in sources :

Example 1 with QueryTargetsMacroExpander

use of com.facebook.buck.rules.macros.QueryTargetsMacroExpander in project buck by facebook.

the class QueryTargetsMacroExpanderTest method setUp.

@Before
public void setUp() throws Exception {
    expander = new QueryTargetsMacroExpander(Optional.empty());
    handler = new MacroHandler(ImmutableMap.of("query", expander));
    filesystem = new FakeProjectFilesystem(tmp.getRoot());
    cellNames = TestCellBuilder.createCellRoots(filesystem);
    TargetNode<?, ?> depNode = JavaLibraryBuilder.createBuilder(BuildTargetFactory.newInstance(filesystem, "//exciting:dep"), filesystem).addSrc(Paths.get("Dep.java")).build();
    TargetNode<?, ?> ruleNode = JavaLibraryBuilder.createBuilder(BuildTargetFactory.newInstance(filesystem, "//exciting:target"), filesystem).addSrc(Paths.get("Other.java")).addDep(depNode.getBuildTarget()).build();
    TargetGraph targetGraph = TargetGraphFactory.newInstance(depNode, ruleNode);
    ruleResolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
    dep = ruleResolver.requireRule(depNode.getBuildTarget());
    rule = ruleResolver.requireRule(ruleNode.getBuildTarget());
}
Also used : MacroHandler(com.facebook.buck.rules.macros.MacroHandler) QueryTargetsMacroExpander(com.facebook.buck.rules.macros.QueryTargetsMacroExpander) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) TargetGraph(com.facebook.buck.rules.TargetGraph) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) Before(org.junit.Before)

Aggregations

BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)1 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)1 TargetGraph (com.facebook.buck.rules.TargetGraph)1 MacroHandler (com.facebook.buck.rules.macros.MacroHandler)1 QueryTargetsMacroExpander (com.facebook.buck.rules.macros.QueryTargetsMacroExpander)1 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)1 Before (org.junit.Before)1