use of com.google.idea.blaze.base.sync.sharding.WildcardTargetExpander.ExpandedTargetsResult in project intellij by bazelbuild.
the class BlazeBuildTargetSharder method doExpandWildcardTargets.
private static ExpandedTargetsResult doExpandWildcardTargets(Project project, BlazeContext context, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, WorkspacePathResolver pathResolver, List<TargetExpression> targets) {
List<WildcardTargetPattern> includes = getWildcardPatterns(targets);
if (includes.isEmpty()) {
return new ExpandedTargetsResult(targets, BuildResult.SUCCESS);
}
Map<TargetExpression, List<TargetExpression>> expandedTargets = WildcardTargetExpander.expandToNonRecursiveWildcardTargets(project, context, pathResolver, includes);
if (expandedTargets == null) {
return new ExpandedTargetsResult(ImmutableList.of(), BuildResult.FATAL_ERROR);
}
// replace original recursive targets with expanded list, retaining relative ordering
List<TargetExpression> fullList = new ArrayList<>();
for (TargetExpression target : targets) {
List<TargetExpression> expanded = expandedTargets.get(target);
if (expanded == null) {
fullList.add(target);
} else {
fullList.addAll(expanded);
}
}
return WildcardTargetExpander.expandToSingleTargets(project, context, workspaceRoot, projectViewSet, fullList);
}
use of com.google.idea.blaze.base.sync.sharding.WildcardTargetExpander.ExpandedTargetsResult in project intellij by bazelbuild.
the class BlazeBuildTargetSharder method expandAndShardTargets.
/**
* Expand wildcard target patterns and partition the resulting target list.
*/
public static ShardedTargetsResult expandAndShardTargets(Project project, BlazeContext context, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, WorkspacePathResolver pathResolver, List<TargetExpression> targets) {
if (!shardingEnabled(projectViewSet)) {
return new ShardedTargetsResult(new ShardedTargetList(ImmutableList.of(targets)), BuildResult.SUCCESS);
}
List<WildcardTargetPattern> wildcardIncludes = getWildcardPatterns(targets);
if (wildcardIncludes.isEmpty()) {
return new ShardedTargetsResult(new ShardedTargetList(ImmutableList.of(targets)), BuildResult.SUCCESS);
}
ExpandedTargetsResult expandedTargets = expandWildcardTargets(project, context, workspaceRoot, projectViewSet, pathResolver, targets);
if (expandedTargets.buildResult.status == BuildResult.Status.FATAL_ERROR) {
return new ShardedTargetsResult(new ShardedTargetList(ImmutableList.of()), expandedTargets.buildResult);
}
return new ShardedTargetsResult(shardTargets(expandedTargets.singleTargets, getTargetShardSize(projectViewSet)), expandedTargets.buildResult);
}
Aggregations