use of com.facebook.buck.rules.macros.MacroHandler in project buck by facebook.
the class QueryOutputsMacroExpanderTest method setUp.
@Before
public void setUp() throws Exception {
expander = new QueryOutputsMacroExpander(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());
}
use of com.facebook.buck.rules.macros.MacroHandler 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());
}
use of com.facebook.buck.rules.macros.MacroHandler in project buck by facebook.
the class PrebuiltCxxLibraryDescription method getBuildRules.
private ImmutableList<BuildRule> getBuildRules(BuildTarget target, CellPathResolver cellNames, BuildRuleResolver ruleResolver, Iterable<String> paramValues) {
ImmutableList.Builder<BuildRule> builder = ImmutableList.builder();
MacroHandler macroHandler = getMacroHandler(Optional.empty());
for (String p : paramValues) {
try {
builder.addAll(macroHandler.extractBuildTimeDeps(target, cellNames, ruleResolver, p));
} catch (MacroException e) {
throw new HumanReadableException(e, "%s : %s in \"%s\"", target, e.getMessage(), p);
}
}
return builder.build();
}
Aggregations