use of com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild in project bazel by bazelbuild.
the class TopLevelArtifactHelperTest method artifactsShouldBeSeparateByGroup.
@Test
public void artifactsShouldBeSeparateByGroup() {
setup(asList(Pair.of("foo", 3), Pair.of("bar", 2)));
ArtifactsToBuild allArtifacts = getAllArtifactsToBuild(groupProvider, null, ctx);
assertEquals(5, size(allArtifacts.getAllArtifacts()));
assertEquals(5, size(allArtifacts.getImportantArtifacts()));
NestedSet<ArtifactsInOutputGroup> artifactsByGroup = allArtifacts.getAllArtifactsByOutputGroup();
// Two groups
assertEquals(2, size(artifactsByGroup));
for (ArtifactsInOutputGroup artifacts : artifactsByGroup) {
String outputGroup = artifacts.getOutputGroup();
if ("foo".equals(outputGroup)) {
assertEquals(3, size(artifacts.getArtifacts()));
} else if ("bar".equals(outputGroup)) {
assertEquals(2, size(artifacts.getArtifacts()));
}
}
}
use of com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild in project bazel by bazelbuild.
the class ExecutionProgressReceiver method evaluated.
@Override
public void evaluated(SkyKey skyKey, Supplier<SkyValue> skyValueSupplier, EvaluationState state) {
SkyFunctionName type = skyKey.functionName();
if (type.equals(SkyFunctions.TARGET_COMPLETION)) {
TargetCompletionValue value = (TargetCompletionValue) skyValueSupplier.get();
if (value == null) {
return;
}
ConfiguredTarget target = value.getConfiguredTarget();
builtTargets.add(target);
if (testedTargets.contains(target)) {
postTestTargetComplete(target);
} else {
postBuildTargetComplete(target);
}
} else if (type.equals(SkyFunctions.ASPECT_COMPLETION)) {
AspectCompletionValue value = (AspectCompletionValue) skyValueSupplier.get();
if (value != null) {
AspectValue aspectValue = value.getAspectValue();
ArtifactsToBuild artifacts = TopLevelArtifactHelper.getAllArtifactsToBuild(aspectValue, topLevelArtifactContext);
eventBus.post(AspectCompleteEvent.createSuccessful(aspectValue, artifacts));
}
} else if (type.equals(SkyFunctions.ACTION_EXECUTION)) {
// Remember all completed actions, even those in error, regardless of having been cached or
// really executed.
actionCompleted((Action) skyKey.argument());
}
}
use of com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild in project bazel by bazelbuild.
the class ExecutionProgressReceiver method postBuildTargetComplete.
private void postBuildTargetComplete(ConfiguredTarget target) {
ArtifactsToBuild artifactsToBuild = TopLevelArtifactHelper.getAllArtifactsToBuild(target, topLevelArtifactContext);
eventBus.post(TargetCompleteEvent.createSuccessfulTarget(target, artifactsToBuild.getAllArtifactsByOutputGroup()));
}
use of com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild in project bazel by bazelbuild.
the class TopLevelArtifactHelperTest method importantArtifacts.
@Test
public void importantArtifacts() {
setup(asList(Pair.of(HIDDEN_OUTPUT_GROUP_PREFIX + "notimportant", 1), Pair.of("important", 2)));
ArtifactsToBuild allArtifacts = getAllArtifactsToBuild(groupProvider, null, ctx);
assertEquals(3, size(allArtifacts.getAllArtifacts()));
assertEquals(2, size(allArtifacts.getImportantArtifacts()));
}
use of com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild in project bazel by bazelbuild.
the class TopLevelArtifactHelperTest method emptyGroupsShouldBeIgnored.
@Test
public void emptyGroupsShouldBeIgnored() {
setup(asList(Pair.of("foo", 1), Pair.of("bar", 0)));
ArtifactsToBuild allArtifacts = getAllArtifactsToBuild(groupProvider, null, ctx);
assertEquals(1, size(allArtifacts.getAllArtifacts()));
assertEquals(1, size(allArtifacts.getImportantArtifacts()));
NestedSet<ArtifactsInOutputGroup> artifactsByGroup = allArtifacts.getAllArtifactsByOutputGroup();
// The bar list should not appear here, as it contains no artifacts.
assertEquals(1, size(artifactsByGroup));
assertEquals("foo", artifactsByGroup.toList().get(0).getOutputGroup());
}
Aggregations