aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ActionArtifactCycleReporter.java19
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java38
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyFunctions.java1
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java1
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java40
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java34
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/TestExecutionFunction.java87
7 files changed, 55 insertions, 165 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionArtifactCycleReporter.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionArtifactCycleReporter.java
index 16977df4dd..8808252848 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionArtifactCycleReporter.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionArtifactCycleReporter.java
@@ -32,13 +32,11 @@ import com.google.devtools.build.skyframe.SkyKey;
*/
public class ActionArtifactCycleReporter extends AbstractLabelCycleReporter {
@SuppressWarnings("unchecked")
- private static final Predicate<SkyKey> IS_ARTIFACT_OR_ACTION_SKY_KEY =
- Predicates.or(
- SkyFunctions.isSkyFunction(SkyFunctions.ARTIFACT),
- SkyFunctions.isSkyFunction(SkyFunctions.ACTION_EXECUTION),
- SkyFunctions.isSkyFunction(SkyFunctions.TARGET_COMPLETION),
- SkyFunctions.isSkyFunction(SkyFunctions.TEST_COMPLETION),
- SkyFunctions.isSkyFunction(SkyFunctions.TEST_EXECUTION));
+ private static final Predicate<SkyKey> IS_ARTIFACT_OR_ACTION_SKY_KEY = Predicates.or(
+ SkyFunctions.isSkyFunction(SkyFunctions.ARTIFACT),
+ SkyFunctions.isSkyFunction(SkyFunctions.ACTION_EXECUTION),
+ SkyFunctions.isSkyFunction(SkyFunctions.TARGET_COMPLETION),
+ SkyFunctions.isSkyFunction(SkyFunctions.TEST_COMPLETION));
ActionArtifactCycleReporter(PackageProvider packageProvider) {
super(packageProvider);
@@ -60,10 +58,6 @@ public class ActionArtifactCycleReporter extends AbstractLabelCycleReporter {
} else if (arg instanceof TestCompletionKey
&& skyFunctionName.equals(SkyFunctions.TEST_COMPLETION)) {
return "test target: " + ((TestCompletionKey) arg).labelAndConfiguration().getLabel();
- } else if (arg instanceof TestExecutionFunction.TestExecutionKey
- && skyFunctionName.equals(SkyFunctions.TEST_EXECUTION)) {
- return "test target: "
- + ((TestExecutionFunction.TestExecutionKey) arg).getLabelAndConfiguration().getLabel();
}
throw new IllegalStateException(
"Argument is not Action, TargetCompletion, TestCompletion or OwnedArtifact: " + arg);
@@ -82,9 +76,6 @@ public class ActionArtifactCycleReporter extends AbstractLabelCycleReporter {
} else if (arg instanceof TestCompletionKey
&& key.functionName().equals(SkyFunctions.TEST_COMPLETION)) {
return ((TestCompletionKey) arg).labelAndConfiguration().getLabel();
- } else if (arg instanceof TestExecutionFunction.TestExecutionKey
- && key.functionName().equals(SkyFunctions.TEST_EXECUTION)) {
- return ((TestExecutionFunction.TestExecutionKey) arg).getLabelAndConfiguration().getLabel();
}
throw new IllegalStateException(
"Argument is not Action, TargetCompletion, TestCompletion or OwnedArtifact: " + arg);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
index 5e100181f8..8744f1a975 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/CompletionFunction.java
@@ -13,10 +13,9 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
import com.google.common.eventbus.EventBus;
import com.google.devtools.build.lib.actions.ActionExecutionException;
+import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.MissingInputFileException;
import com.google.devtools.build.lib.analysis.AspectCompleteEvent;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
@@ -56,13 +55,6 @@ public final class CompletionFunction<TValue extends SkyValue, TResult extends S
TValue getValueFromSkyKey(SkyKey skyKey, Environment env) throws InterruptedException;
/**
- * Gets any additional {@link SkyKey}s that should be requested in this {@link SkyFunction} for
- * increased parallelism, together with the owner for each. The owner is only used in case of a
- * {@link MissingInputFileException} thrown when trying to retrieve the key.
- */
- ImmutableMap<SkyKey, Label> getExtraSkyKeysWithOwnersToRequest(SkyKey skyKey);
-
- /**
* Returns the options which determine the artifacts to build for the top-level targets.
* <p>
* For the Top level targets we made a conscious decision to include the TopLevelArtifactContext
@@ -115,15 +107,6 @@ public final class CompletionFunction<TValue extends SkyValue, TResult extends S
}
@Override
- public ImmutableMap<SkyKey, Label> getExtraSkyKeysWithOwnersToRequest(SkyKey skyKey) {
- TargetCompletionKey tcKey = (TargetCompletionKey) skyKey.argument();
- SkyKey testExecutionSkyKey = tcKey.testExecutionSkyKey();
- return testExecutionSkyKey == null
- ? ImmutableMap.of()
- : ImmutableMap.of(testExecutionSkyKey, tcKey.labelAndConfiguration().getLabel());
- }
-
- @Override
public TopLevelArtifactContext getTopLevelArtifactContext(SkyKey skyKey) {
TargetCompletionKey tcKey = (TargetCompletionKey) skyKey.argument();
return tcKey.topLevelArtifactContext();
@@ -182,11 +165,6 @@ public final class CompletionFunction<TValue extends SkyValue, TResult extends S
}
@Override
- public ImmutableMap<SkyKey, Label> getExtraSkyKeysWithOwnersToRequest(SkyKey skyKey) {
- return ImmutableMap.of();
- }
-
- @Override
public TopLevelArtifactContext getTopLevelArtifactContext(SkyKey skyKey) {
AspectCompletionKey acKey = (AspectCompletionKey) skyKey.argument();
return acKey.topLevelArtifactContext();
@@ -263,14 +241,10 @@ public final class CompletionFunction<TValue extends SkyValue, TResult extends S
return null;
}
- ImmutableMap<SkyKey, Label> extraSkyKeysToOwner =
- completor.getExtraSkyKeysWithOwnersToRequest(skyKey);
Map<SkyKey, ValueOrException2<MissingInputFileException, ActionExecutionException>> inputDeps =
env.getValuesOrThrow(
- Iterables.concat(
- ArtifactSkyKey.mandatoryKeys(
- completor.getAllArtifactsToBuild(value, topLevelContext).getAllArtifacts()),
- extraSkyKeysToOwner.keySet()),
+ ArtifactSkyKey.mandatoryKeys(
+ completor.getAllArtifactsToBuild(value, topLevelContext).getAllArtifacts()),
MissingInputFileException.class,
ActionExecutionException.class);
@@ -280,14 +254,12 @@ public final class CompletionFunction<TValue extends SkyValue, TResult extends S
NestedSetBuilder<Cause> rootCausesBuilder = NestedSetBuilder.stableOrder();
for (Map.Entry<SkyKey, ValueOrException2<MissingInputFileException, ActionExecutionException>>
depsEntry : inputDeps.entrySet()) {
+ Artifact input = ArtifactSkyKey.artifact(depsEntry.getKey());
try {
depsEntry.getValue().get();
} catch (MissingInputFileException e) {
missingCount++;
- Label inputOwner = extraSkyKeysToOwner.get(depsEntry.getKey());
- if (inputOwner == null) {
- inputOwner = ArtifactSkyKey.artifact(depsEntry.getKey()).getOwner();
- }
+ final Label inputOwner = input.getOwner();
if (inputOwner != null) {
Cause cause = new LabelCause(inputOwner);
rootCausesBuilder.add(cause);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyFunctions.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyFunctions.java
index e7acc502f4..4f7479b5d6 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyFunctions.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyFunctions.java
@@ -78,7 +78,6 @@ public final class SkyFunctions {
SkyFunctionName.create("TARGET_COMPLETION");
public static final SkyFunctionName ASPECT_COMPLETION =
SkyFunctionName.create("ASPECT_COMPLETION");
- public static final SkyFunctionName TEST_EXECUTION = SkyFunctionName.create("TEST_EXECUTION");
public static final SkyFunctionName TEST_COMPLETION = SkyFunctionName.create("TEST_COMPLETION");
public static final SkyFunctionName BUILD_CONFIGURATION =
SkyFunctionName.create("BUILD_CONFIGURATION");
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
index 77bc25bfea..f61ba9c54a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java
@@ -435,7 +435,6 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory {
map.put(SkyFunctions.TARGET_COMPLETION, CompletionFunction.targetCompletionFunction(eventBus));
map.put(SkyFunctions.ASPECT_COMPLETION, CompletionFunction.aspectCompletionFunction(eventBus));
map.put(SkyFunctions.TEST_COMPLETION, new TestCompletionFunction());
- map.put(SkyFunctions.TEST_EXECUTION, new TestExecutionFunction());
map.put(SkyFunctions.ARTIFACT, new ArtifactFunction(allowedMissingInputs));
map.put(
SkyFunctions.BUILD_INFO_COLLECTION,
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java
index 6c84563619..476f69da44 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java
@@ -14,15 +14,15 @@
package com.google.devtools.build.lib.skyframe;
import com.google.auto.value.AutoValue;
+import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.LabelAndConfiguration;
import com.google.devtools.build.lib.analysis.TopLevelArtifactContext;
-import com.google.devtools.build.skyframe.SkyFunctionName;
+import com.google.devtools.build.skyframe.LegacySkyKey;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import java.util.Collection;
-import javax.annotation.Nullable;
/**
* The value of a TargetCompletion. Currently this just stores a ConfiguredTarget.
@@ -40,38 +40,36 @@ public class TargetCompletionValue implements SkyValue {
public static SkyKey key(
LabelAndConfiguration labelAndConfiguration,
- TopLevelArtifactContext topLevelArtifactContext,
- SkyKey testExecutionSkyKey) {
- return TargetCompletionKey.create(
- labelAndConfiguration, topLevelArtifactContext, testExecutionSkyKey);
+ TopLevelArtifactContext topLevelArtifactContext) {
+ return LegacySkyKey.create(
+ SkyFunctions.TARGET_COMPLETION,
+ TargetCompletionKey.create(labelAndConfiguration, topLevelArtifactContext));
}
public static Iterable<SkyKey> keys(Collection<ConfiguredTarget> targets,
final TopLevelArtifactContext ctx) {
return Iterables.transform(
- targets, ct -> TargetCompletionKey.create(LabelAndConfiguration.of(ct), ctx, null));
+ targets,
+ new Function<ConfiguredTarget, SkyKey>() {
+ @Override
+ public SkyKey apply(ConfiguredTarget ct) {
+ return LegacySkyKey.create(
+ SkyFunctions.TARGET_COMPLETION,
+ TargetCompletionKey.create(LabelAndConfiguration.of(ct), ctx));
+ }
+ });
}
@AutoValue
- abstract static class TargetCompletionKey implements SkyKey {
+ abstract static class TargetCompletionKey {
public static TargetCompletionKey create(
LabelAndConfiguration labelAndConfiguration,
- TopLevelArtifactContext topLevelArtifactContext,
- @Nullable SkyKey testExecutionSkyKey) {
+ TopLevelArtifactContext topLevelArtifactContext) {
return new AutoValue_TargetCompletionValue_TargetCompletionKey(
- labelAndConfiguration, topLevelArtifactContext, testExecutionSkyKey);
+ labelAndConfiguration, topLevelArtifactContext);
}
- abstract LabelAndConfiguration labelAndConfiguration();
-
+ public abstract LabelAndConfiguration labelAndConfiguration();
public abstract TopLevelArtifactContext topLevelArtifactContext();
-
- @Nullable
- abstract SkyKey testExecutionSkyKey();
-
- @Override
- public SkyFunctionName functionName() {
- return SkyFunctions.TARGET_COMPLETION;
- }
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java
index 1dc46cedfe..dcdf47e11d 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TestCompletionFunction.java
@@ -13,8 +13,11 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
+import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.LabelAndConfiguration;
import com.google.devtools.build.lib.analysis.TopLevelArtifactContext;
+import com.google.devtools.build.lib.analysis.test.TestProvider;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyKey;
@@ -32,20 +35,35 @@ public final class TestCompletionFunction implements SkyFunction {
(TestCompletionValue.TestCompletionKey) skyKey.argument();
LabelAndConfiguration lac = key.labelAndConfiguration();
TopLevelArtifactContext ctx = key.topLevelArtifactContext();
- env.getValue(
- TargetCompletionValue.key(
- lac, ctx, TestExecutionFunction.key(lac, key.exclusiveTesting())));
- if (env.valuesMissing()) {
+ if (env.getValue(TargetCompletionValue.key(lac, ctx)) == null) {
return null;
}
+
+ ConfiguredTargetValue ctValue = (ConfiguredTargetValue)
+ env.getValue(ConfiguredTargetValue.key(lac.getLabel(), lac.getConfiguration()));
+ if (ctValue == null) {
+ return null;
+ }
+
+ ConfiguredTarget ct = ctValue.getConfiguredTarget();
+ if (key.exclusiveTesting()) {
+ // Request test artifacts iteratively if testing exclusively.
+ for (Artifact testArtifact : TestProvider.getTestStatusArtifacts(ct)) {
+ if (env.getValue(ArtifactSkyKey.key(testArtifact, /*isMandatory=*/ true)) == null) {
+ return null;
+ }
+ }
+ } else {
+ env.getValues(ArtifactSkyKey.mandatoryKeys(TestProvider.getTestStatusArtifacts(ct)));
+ if (env.valuesMissing()) {
+ return null;
+ }
+ }
return TestCompletionValue.TEST_COMPLETION_MARKER;
}
@Override
public String extractTag(SkyKey skyKey) {
- return Label.print(
- ((TestCompletionValue.TestCompletionKey) skyKey.argument())
- .labelAndConfiguration()
- .getLabel());
+ return Label.print(((LabelAndConfiguration) skyKey.argument()).getLabel());
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TestExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TestExecutionFunction.java
deleted file mode 100644
index a752c7dc9e..0000000000
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TestExecutionFunction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2017 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.devtools.build.lib.skyframe;
-
-import com.google.auto.value.AutoValue;
-import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.analysis.ConfiguredTarget;
-import com.google.devtools.build.lib.analysis.LabelAndConfiguration;
-import com.google.devtools.build.lib.analysis.test.TestProvider;
-import com.google.devtools.build.lib.cmdline.Label;
-import com.google.devtools.build.skyframe.SkyFunction;
-import com.google.devtools.build.skyframe.SkyFunctionName;
-import com.google.devtools.build.skyframe.SkyKey;
-import com.google.devtools.build.skyframe.SkyValue;
-import javax.annotation.Nullable;
-
-/** {@link SkyFunction} to ensure that a test has executed. */
-class TestExecutionFunction implements SkyFunction {
- private static final SkyValue TEST_EXECUTION_MARKER = new SkyValue() {};
-
- static SkyKey key(LabelAndConfiguration lac, boolean exclusiveTesting) {
- return TestExecutionKey.create(lac, exclusiveTesting);
- }
-
- @AutoValue
- abstract static class TestExecutionKey implements SkyKey {
- abstract LabelAndConfiguration getLabelAndConfiguration();
-
- abstract boolean exclusiveTesting();
-
- static TestExecutionKey create(LabelAndConfiguration lac, boolean exclusiveTesting) {
- return new AutoValue_TestExecutionFunction_TestExecutionKey(lac, exclusiveTesting);
- }
-
- @Override
- public SkyFunctionName functionName() {
- return SkyFunctions.TEST_EXECUTION;
- }
- }
-
- @Nullable
- @Override
- public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
- TestExecutionKey key = (TestExecutionKey) skyKey.argument();
- LabelAndConfiguration lac = key.getLabelAndConfiguration();
- ConfiguredTargetValue ctValue =
- (ConfiguredTargetValue)
- env.getValue(ConfiguredTargetValue.key(lac.getLabel(), lac.getConfiguration()));
- if (ctValue == null) {
- return null;
- }
-
- ConfiguredTarget ct = ctValue.getConfiguredTarget();
- if (key.exclusiveTesting()) {
- // Request test artifacts iteratively if testing exclusively.
- for (Artifact testArtifact : TestProvider.getTestStatusArtifacts(ct)) {
- if (env.getValue(ArtifactSkyKey.key(testArtifact, /*isMandatory=*/ true)) == null) {
- return null;
- }
- }
- } else {
- env.getValues(ArtifactSkyKey.mandatoryKeys(TestProvider.getTestStatusArtifacts(ct)));
- if (env.valuesMissing()) {
- return null;
- }
- }
- return TEST_EXECUTION_MARKER;
- }
-
- @Override
- public String extractTag(SkyKey skyKey) {
- return Label.print(
- ((TestExecutionKey) skyKey.argument()).getLabelAndConfiguration().getLabel());
- }
-}