Search in sources :

Example 1 with ArtifactsToBuild

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()));
        }
    }
}
Also used : ArtifactsInOutputGroup(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsInOutputGroup) TopLevelArtifactHelper.getAllArtifactsToBuild(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.getAllArtifactsToBuild) ArtifactsToBuild(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild) Test(org.junit.Test)

Example 2 with ArtifactsToBuild

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());
    }
}
Also used : SkyFunctionName(com.google.devtools.build.skyframe.SkyFunctionName) AspectValue(com.google.devtools.build.lib.skyframe.AspectValue) AspectCompletionValue(com.google.devtools.build.lib.skyframe.AspectCompletionValue) ConfiguredTarget(com.google.devtools.build.lib.analysis.ConfiguredTarget) TargetCompletionValue(com.google.devtools.build.lib.skyframe.TargetCompletionValue) ArtifactsToBuild(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild)

Example 3 with ArtifactsToBuild

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()));
}
Also used : ArtifactsToBuild(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild)

Example 4 with ArtifactsToBuild

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()));
}
Also used : TopLevelArtifactHelper.getAllArtifactsToBuild(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.getAllArtifactsToBuild) ArtifactsToBuild(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild) Test(org.junit.Test)

Example 5 with ArtifactsToBuild

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());
}
Also used : ArtifactsInOutputGroup(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsInOutputGroup) TopLevelArtifactHelper.getAllArtifactsToBuild(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.getAllArtifactsToBuild) ArtifactsToBuild(com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild) Test(org.junit.Test)

Aggregations

ArtifactsToBuild (com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsToBuild)5 TopLevelArtifactHelper.getAllArtifactsToBuild (com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.getAllArtifactsToBuild)3 Test (org.junit.Test)3 ArtifactsInOutputGroup (com.google.devtools.build.lib.analysis.TopLevelArtifactHelper.ArtifactsInOutputGroup)2 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)1 AspectCompletionValue (com.google.devtools.build.lib.skyframe.AspectCompletionValue)1 AspectValue (com.google.devtools.build.lib.skyframe.AspectValue)1 TargetCompletionValue (com.google.devtools.build.lib.skyframe.TargetCompletionValue)1 SkyFunctionName (com.google.devtools.build.skyframe.SkyFunctionName)1