use of com.facebook.buck.rules.CellPathResolver in project buck by facebook.
the class DistBuildSlaveExecutor method fullyQualifiedNameToBuildTarget.
private List<BuildTarget> fullyQualifiedNameToBuildTarget(Iterable<String> buildTargets) {
List<BuildTarget> targets = Lists.newArrayList();
CellPathResolver distBuildCellPathResolver = args.getState().getRootCell().getCellPathResolver();
for (String fullyQualifiedBuildTarget : buildTargets) {
BuildTarget target = BuildTargetParser.INSTANCE.parse(fullyQualifiedBuildTarget, BuildTargetPatternParser.fullyQualified(), distBuildCellPathResolver);
targets.add(target);
}
return targets;
}
use of com.facebook.buck.rules.CellPathResolver in project buck by facebook.
the class QueryUtils method extractBuildTargets.
public static Stream<BuildTarget> extractBuildTargets(CellPathResolver cellPathResolver, BuildTargetPatternParser<BuildTargetPattern> parserPattern, Query query) throws QueryException {
GraphEnhancementQueryEnvironment env = new GraphEnhancementQueryEnvironment(Optional.empty(), Optional.empty(), cellPathResolver, parserPattern, ImmutableSet.of());
ListeningExecutorService executorService = MoreExecutors.newDirectExecutorService();
QueryExpression parsedExp = QueryExpression.parse(query.getQuery(), env);
List<String> targetLiterals = new ArrayList<>();
parsedExp.collectTargetPatterns(targetLiterals);
return targetLiterals.stream().flatMap(pattern -> {
try {
return env.getTargetsMatchingPattern(pattern, executorService).stream();
} catch (Exception e) {
throw new RuntimeException("Error parsing target expression", e);
}
}).map(queryTarget -> {
Preconditions.checkState(queryTarget instanceof QueryBuildTarget);
return ((QueryBuildTarget) queryTarget).getBuildTarget();
});
}
Aggregations