Search in sources :

Example 1 with BuildBinaryType

use of com.google.idea.blaze.base.settings.BuildBinaryType in project intellij by bazelbuild.

the class BlazeBuildParams method fromProject.

public static BlazeBuildParams fromProject(Project project) {
    BuildSystemProvider provider = Blaze.getBuildSystemProvider(project);
    BuildBinaryType binaryType = provider.getSyncBinaryType();
    return builder().setBlazeBinaryPath(provider.getSyncBinaryPath(project)).setBlazeBinaryType(binaryType).setParallelizeBuilds(binaryType.isRemote).build();
}
Also used : BuildBinaryType(com.google.idea.blaze.base.settings.BuildBinaryType) BuildSystemProvider(com.google.idea.blaze.base.bazel.BuildSystemProvider)

Example 2 with BuildBinaryType

use of com.google.idea.blaze.base.settings.BuildBinaryType 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, BlazeBuildParams buildParams, ProjectViewSet viewSet, WorkspacePathResolver pathResolver, List<TargetExpression> targets) {
    BuildBinaryType buildType = buildParams.blazeBinaryType();
    ShardingApproach approach = getShardingApproach(viewSet, buildType.isRemote);
    switch(approach) {
        case SHARD_WITHOUT_EXPANDING:
            int suggestedSize = getTargetShardSize(viewSet);
            return new ShardedTargetsResult(new ShardedTargetList(shardTargetsRetainingOrdering(targets, suggestedSize), ShardStats.ShardingApproach.PARTITION_WITHOUT_EXPANDING, suggestedSize), BuildResult.SUCCESS);
        case EXPAND_AND_SHARD:
            ExpandedTargetsResult expandedTargets = expandWildcardTargets(project, context, workspaceRoot, buildParams, viewSet, pathResolver, targets);
            if (expandedTargets.buildResult.status == BuildResult.Status.FATAL_ERROR) {
                return new ShardedTargetsResult(new ShardedTargetList(ImmutableList.of(), ShardStats.ShardingApproach.ERROR, 0), expandedTargets.buildResult);
            }
            return new ShardedTargetsResult(shardSingleTargets(expandedTargets.singleTargets, buildType, getTargetShardSize(viewSet)), expandedTargets.buildResult);
        default:
            throw new IllegalStateException("Unhandled sharding approach: " + approach);
    }
}
Also used : BuildBinaryType(com.google.idea.blaze.base.settings.BuildBinaryType) ExpandedTargetsResult(com.google.idea.blaze.base.sync.sharding.WildcardTargetExpander.ExpandedTargetsResult)

Aggregations

BuildBinaryType (com.google.idea.blaze.base.settings.BuildBinaryType)2 BuildSystemProvider (com.google.idea.blaze.base.bazel.BuildSystemProvider)1 ExpandedTargetsResult (com.google.idea.blaze.base.sync.sharding.WildcardTargetExpander.ExpandedTargetsResult)1