use of com.google.idea.blaze.base.logging.utils.ShardStats in project intellij by bazelbuild.
the class BlazeBuildTargetSharderTest method expandAndShardTargets_expandWildcardTargets.
@Test
public void expandAndShardTargets_expandWildcardTargets() {
String expectedLabel1 = "//java/com/google:one";
String expectedLabel2 = "//java/com/google:two";
fakeWildCardTargetExpanderExternalTaskProvider.setReturnVal(0).setOutputMessage("sh_library rule " + expectedLabel1, "sh_library rule " + expectedLabel2);
fakeBuildBatchingService.setShardingApproach(ShardingApproach.LEXICOGRAPHIC_TARGET_SHARDER).setFailToBatchTarget(false);
List<TargetExpression> targets = ImmutableList.of(target("//java/com/google/..."));
ShardedTargetsResult result = expandAndShardTargets(SyncStrategy.PARALLEL, ProjectView.builder().add(ScalarSection.builder(ShardBlazeBuildsSection.KEY).set(true)).add(ScalarSection.builder(TargetShardSizeSection.KEY).set(500)).build(), targets);
ShardStats shardStats = result.shardedTargets.shardStats;
assertThat(shardStats.suggestedTargetSizePerShard()).isEqualTo(500);
assertThat(shardStats.actualTargetSizePerShard()).containsExactly(2);
assertThat(result.shardedTargets.shardedTargets).containsExactly(ImmutableList.of(target(expectedLabel1), target(expectedLabel2)));
}
use of com.google.idea.blaze.base.logging.utils.ShardStats in project intellij by bazelbuild.
the class BlazeBuildTargetSharderTest method expandAndShardTargets_localBuild_buildBatchingServiceIsUsed.
@Test
public void expandAndShardTargets_localBuild_buildBatchingServiceIsUsed() {
fakeBuildBatchingService.setShardingApproach(ShardingApproach.LEXICOGRAPHIC_TARGET_SHARDER).setFailToBatchTarget(false);
List<TargetExpression> targets = ImmutableList.of(target("//java/com/google:foo"));
ShardedTargetsResult result = expandAndShardTargets(SyncStrategy.PARALLEL, ProjectView.builder().add(ScalarSection.builder(ShardBlazeBuildsSection.KEY).set(true)).add(ScalarSection.builder(TargetShardSizeSection.KEY).set(500)).build(), targets);
assertThat(result.buildResult.exitCode).isEqualTo(0);
ShardStats shardStats = result.shardedTargets.shardStats;
assertThat(shardStats.shardingApproach()).isEqualTo(ShardingApproach.LEXICOGRAPHIC_TARGET_SHARDER);
}
Aggregations