diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe')
15 files changed, 77 insertions, 62 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java index 5a39dbbf8a..a6a110cc51 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java @@ -92,6 +92,7 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver @Override public SkyValue compute(SkyKey skyKey, Environment env) throws ActionExecutionFunctionException, InterruptedException { + Preconditions.checkArgument(skyKey.argument() instanceof Action); Action action = (Action) skyKey.argument(); // TODO(bazel-team): Non-volatile NotifyOnActionCacheHit actions perform worse in Skyframe than // legacy when they are not at the top of the action graph. In legacy, they are stored diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java index fdce7c69b3..e56ef46f6d 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionValue.java @@ -18,7 +18,7 @@ import com.google.common.base.MoreObjects; import com.google.common.base.Objects; import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.actions.Action; -import com.google.devtools.build.lib.actions.Action.MiddlemanType; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata.MiddlemanType; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe; diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionLookupValue.java index e40817c137..db23b453ca 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionLookupValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionLookupValue.java @@ -16,7 +16,7 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.actions.Actions; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ArtifactOwner; @@ -34,10 +34,10 @@ import java.util.Map; * actions of target completion values and build info artifacts also fall into this category. */ public class ActionLookupValue implements SkyValue { - protected final ImmutableMap<Artifact, Action> generatingActionMap; + protected final ImmutableMap<Artifact, ActionAnalysisMetadata> generatingActionMap; - private static Map<Artifact, Action> filterSharedActionsAndThrowRuntimeIfConflict( - Iterable<Action> actions) { + private static Map<Artifact, ActionAnalysisMetadata> filterSharedActionsAndThrowRuntimeIfConflict( + Iterable<ActionAnalysisMetadata> actions) { try { return Actions.filterSharedActionsAndThrowActionConflict(actions); } catch (ActionConflictException e) { @@ -46,24 +46,24 @@ public class ActionLookupValue implements SkyValue { } } - ActionLookupValue(Iterable<Action> actions) { + ActionLookupValue(Iterable<ActionAnalysisMetadata> actions) { this(filterSharedActionsAndThrowRuntimeIfConflict(actions)); } - ActionLookupValue(Action action) { + ActionLookupValue(ActionAnalysisMetadata action) { this(ImmutableList.of(action)); } - ActionLookupValue(Map<Artifact, Action> generatingActionMap) { + ActionLookupValue(Map<Artifact, ActionAnalysisMetadata> generatingActionMap) { this.generatingActionMap = ImmutableMap.copyOf(generatingActionMap); } - public Action getGeneratingAction(Artifact artifact) { + public ActionAnalysisMetadata getGeneratingAction(Artifact artifact) { return generatingActionMap.get(artifact); } /** To be used only when checking consistency of the action graph -- not by other values. */ - ImmutableMap<Artifact, Action> getMapForConsistencyCheck() { + ImmutableMap<Artifact, ActionAnalysisMetadata> getMapForConsistencyCheck() { return generatingActionMap; } @@ -71,7 +71,7 @@ public class ActionLookupValue implements SkyValue { * To be used only when setting the owners of deserialized artifacts whose owners were unknown at * creation time -- not by other callers or values. */ - Iterable<Action> getActionsForFindingArtifactOwners() { + Iterable<ActionAnalysisMetadata> getActionsForFindingArtifactOwners() { return generatingActionMap.values(); } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java index 312feefcef..c8022d5e89 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java @@ -16,7 +16,8 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.actions.Action; -import com.google.devtools.build.lib.actions.Action.MiddlemanType; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata.MiddlemanType; import com.google.devtools.build.lib.actions.ActionExecutionException; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ArtifactOwner; @@ -65,11 +66,16 @@ class ArtifactFunction implements SkyFunction { } } - Action action = extractActionFromArtifact(artifact, env); - if (action == null) { + ActionAnalysisMetadata actionMetadata = extractActionFromArtifact(artifact, env); + if (actionMetadata == null) { return null; } + Preconditions.checkState( + actionMetadata instanceof Action, + "%s is not a proper Action object and therefore cannot be executed", + actionMetadata); + Action action = (Action) actionMetadata; ActionExecutionValue actionValue = (ActionExecutionValue) env.getValue(ActionExecutionValue.key(action)); if (actionValue == null) { @@ -165,8 +171,8 @@ class ArtifactFunction implements SkyFunction { return FileArtifactValue.create(artifact, data); } - private AggregatingArtifactValue createAggregatingValue(Artifact artifact, Action action, - FileArtifactValue value, SkyFunction.Environment env) { + private AggregatingArtifactValue createAggregatingValue(Artifact artifact, + ActionAnalysisMetadata action, FileArtifactValue value, SkyFunction.Environment env) { // This artifact aggregates other artifacts. Keep track of them so callers can find them. ImmutableList.Builder<Pair<Artifact, FileArtifactValue>> inputs = ImmutableList.builder(); for (Map.Entry<SkyKey, SkyValue> entry : @@ -190,7 +196,7 @@ class ArtifactFunction implements SkyFunction { * see if the action is an aggregating middleman action. However, may include runfiles middleman * actions and Fileset artifacts in the future. */ - private static boolean isAggregatingValue(Action action) { + private static boolean isAggregatingValue(ActionAnalysisMetadata action) { return action.getActionType() == MiddlemanType.AGGREGATING_MIDDLEMAN; } @@ -199,7 +205,8 @@ class ArtifactFunction implements SkyFunction { return Label.print(((OwnedArtifact) skyKey.argument()).getArtifact().getOwner()); } - private Action extractActionFromArtifact(Artifact artifact, SkyFunction.Environment env) { + private ActionAnalysisMetadata extractActionFromArtifact( + Artifact artifact, SkyFunction.Environment env) { ArtifactOwner artifactOwner = artifact.getArtifactOwner(); Preconditions.checkState(artifactOwner instanceof ActionLookupKey, "", artifact, artifactOwner); diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java index 56878b153b..f37e5e2963 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectFunction.java @@ -16,7 +16,7 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.collect.ImmutableList; import com.google.common.collect.ListMultimap; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.analysis.CachingAnalysisEnvironment; import com.google.devtools.build.lib.analysis.ConfiguredAspect; import com.google.devtools.build.lib.analysis.ConfiguredAspectFactory; @@ -288,7 +288,7 @@ public final class AspectFunction implements SkyFunction { originalTarget.getLabel(), originalTarget.getLocation(), ConfiguredAspect.forAlias(real.getConfiguredAspect()), - ImmutableList.<Action>of(), + ImmutableList.<ActionAnalysisMetadata>of(), transitivePackages); } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AspectValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/AspectValue.java index effd33f2a4..33cf880a6a 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/AspectValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/AspectValue.java @@ -15,7 +15,7 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.base.Objects; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.analysis.ConfiguredAspect; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.cmdline.Label; @@ -247,7 +247,7 @@ public final class AspectValue extends ActionLookupValue { Label label, Location location, ConfiguredAspect configuredAspect, - Iterable<Action> actions, + Iterable<ActionAnalysisMetadata> actions, NestedSet<Package> transitivePackages) { super(actions); this.aspect = aspect; diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java index 0a5caf065e..6fb86c8dec 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java @@ -23,7 +23,7 @@ import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.actions.Actions; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException; @@ -846,7 +846,7 @@ final class ConfiguredTargetFunction implements SkyFunction { analysisEnvironment.disable(target); Preconditions.checkNotNull(configuredTarget, target); - Map<Artifact, Action> generatingActions; + Map<Artifact, ActionAnalysisMetadata> generatingActions; // Check for conflicting actions within this configured target (that indicates a bug in the // rule implementation). try { diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetValue.java index 3918bf7d09..7f32c1e19b 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetValue.java @@ -16,7 +16,7 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; @@ -46,12 +46,13 @@ public final class ConfiguredTargetValue extends ActionLookupValue { // We overload this variable to check whether the value has been clear()ed. We don't use a // separate variable in order to save memory. - @Nullable private volatile Iterable<Action> actions; + @Nullable private volatile Iterable<ActionAnalysisMetadata> actions; private final NestedSet<Package> transitivePackages; ConfiguredTargetValue(ConfiguredTarget configuredTarget, - Map<Artifact, Action> generatingActionMap, NestedSet<Package> transitivePackages) { + Map<Artifact, ActionAnalysisMetadata> generatingActionMap, + NestedSet<Package> transitivePackages) { super(generatingActionMap); this.configuredTarget = configuredTarget; this.actions = generatingActionMap.values(); @@ -65,7 +66,7 @@ public final class ConfiguredTargetValue extends ActionLookupValue { } @VisibleForTesting - public Iterable<Action> getActions() { + public Iterable<ActionAnalysisMetadata> getActions() { return Preconditions.checkNotNull(actions, configuredTarget); } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java index 0a13579afb..53d7a86102 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportFunction.java @@ -16,7 +16,7 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.skyframe.SkyFunction; @@ -35,14 +35,14 @@ public class CoverageReportFunction implements SkyFunction { CoverageReportValue.SKY_KEY.equals(skyKey), String.format( "Expected %s for SkyKey but got %s instead", CoverageReportValue.SKY_KEY, skyKey)); - ImmutableList <Action> actions = PrecomputedValue.COVERAGE_REPORT_KEY.get(env); + ImmutableList<ActionAnalysisMetadata> actions = PrecomputedValue.COVERAGE_REPORT_KEY.get(env); if (actions == null) { return null; } ImmutableSet.Builder<Artifact> outputs = new ImmutableSet.Builder<>(); - for (Action action : actions) { + for (ActionAnalysisMetadata action : actions) { outputs.addAll(action.getOutputs()); } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportValue.java index 44722b563e..27ace7605b 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportValue.java @@ -16,7 +16,7 @@ package com.google.devtools.build.lib.skyframe; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ArtifactOwner; import com.google.devtools.build.skyframe.SkyFunctionName; @@ -34,7 +34,7 @@ public class CoverageReportValue extends ActionLookupValue { public static final ArtifactOwner ARTIFACT_OWNER = new CoverageReportKey(); public CoverageReportValue(ImmutableSet<Artifact> coverageReportArtifacts, - ImmutableList <Action> coverageReportActions) { + ImmutableList <ActionAnalysisMetadata> coverageReportActions) { super(coverageReportActions); this.coverageReportArtifacts = coverageReportArtifacts; } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java index 878caeca08..c33e599412 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PostConfiguredTargetFunction.java @@ -18,7 +18,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.ListMultimap; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.Dependency; import com.google.devtools.build.lib.analysis.LabelAndConfiguration; @@ -72,14 +72,15 @@ public class PostConfiguredTargetFunction implements SkyFunction { @Override public SkyValue compute(SkyKey skyKey, Environment env) throws SkyFunctionException, InterruptedException { - ImmutableMap<Action, ConflictException> badActions = PrecomputedValue.BAD_ACTIONS.get(env); + ImmutableMap<ActionAnalysisMetadata, ConflictException> badActions = + PrecomputedValue.BAD_ACTIONS.get(env); ConfiguredTargetValue ctValue = (ConfiguredTargetValue) env.getValue(ConfiguredTargetValue.key((ConfiguredTargetKey) skyKey.argument())); if (env.valuesMissing()) { return null; } - for (Action action : ctValue.getActions()) { + for (ActionAnalysisMetadata action : ctValue.getActions()) { if (badActions.containsKey(action)) { throw new ActionConflictFunctionException(badActions.get(action)); } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java index 0746b62134..8d20b9ea97 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PrecomputedValue.java @@ -18,7 +18,7 @@ import com.google.common.base.Supplier; import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.analysis.BlazeDirectories; import com.google.devtools.build.lib.analysis.TopLevelArtifactContext; import com.google.devtools.build.lib.analysis.WorkspaceStatusAction; @@ -89,7 +89,7 @@ public final class PrecomputedValue implements SkyValue { static final Precomputed<WorkspaceStatusAction> WORKSPACE_STATUS_KEY = new Precomputed<>(SkyKey.create(SkyFunctions.PRECOMPUTED, "workspace_status_action")); - static final Precomputed<ImmutableList<Action>> COVERAGE_REPORT_KEY = + static final Precomputed<ImmutableList<ActionAnalysisMetadata>> COVERAGE_REPORT_KEY = new Precomputed<>(SkyKey.create(SkyFunctions.PRECOMPUTED, "coverage_report_actions")); static final Precomputed<TopLevelArtifactContext> TOP_LEVEL_CONTEXT = @@ -101,7 +101,7 @@ public final class PrecomputedValue implements SkyValue { public static final Precomputed<BlazeDirectories> BLAZE_DIRECTORIES = new Precomputed<>(SkyKey.create(SkyFunctions.PRECOMPUTED, "blaze_directories")); - static final Precomputed<ImmutableMap<Action, ConflictException>> BAD_ACTIONS = + static final Precomputed<ImmutableMap<ActionAnalysisMetadata, ConflictException>> BAD_ACTIONS = new Precomputed<>(SkyKey.create(SkyFunctions.PRECOMPUTED, "bad_actions")); public static final Precomputed<PathPackageLocator> PATH_PACKAGE_LOCATOR = diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java index 520cc0f0b6..3e0f2a5eb3 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java @@ -21,6 +21,7 @@ import com.google.common.collect.Maps; import com.google.common.eventbus.EventBus; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.actions.ActionCacheChecker; import com.google.devtools.build.lib.actions.ActionCacheChecker.Token; import com.google.devtools.build.lib.actions.ActionCompletionEvent; @@ -126,7 +127,7 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto // Errors found when examining all actions in the graph are stored here, so that they can be // thrown when execution of the action is requested. This field is set during each call to // findAndStoreArtifactConflicts, and is preserved across builds otherwise. - private ImmutableMap<Action, ConflictException> badActionMap = ImmutableMap.of(); + private ImmutableMap<ActionAnalysisMetadata, ConflictException> badActionMap = ImmutableMap.of(); private boolean keepGoing; private boolean hadExecutionError; private ActionInputFileCache perBuildFileCache; @@ -179,7 +180,7 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto * Return the map of mostly recently executed bad actions to their corresponding exception. * See {#findAndStoreArtifactConflicts()}. */ - public ImmutableMap<Action, ConflictException> badActions() { + public ImmutableMap<ActionAnalysisMetadata, ConflictException> badActions() { // TODO(bazel-team): Move badActions() and findAndStoreArtifactConflicts() to SkyframeBuildView // now that it's done in the analysis phase. return badActionMap; @@ -215,15 +216,16 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto */ void findAndStoreArtifactConflicts(Iterable<ActionLookupValue> actionLookupValues) throws InterruptedException { - ConcurrentMap<Action, ConflictException> temporaryBadActionMap = new ConcurrentHashMap<>(); + ConcurrentMap<ActionAnalysisMetadata, ConflictException> temporaryBadActionMap = + new ConcurrentHashMap<>(); Pair<ActionGraph, SortedMap<PathFragment, Artifact>> result; result = constructActionGraphAndPathMap(actionLookupValues, temporaryBadActionMap); ActionGraph actionGraph = result.first; SortedMap<PathFragment, Artifact> artifactPathMap = result.second; - Map<Action, ArtifactPrefixConflictException> actionsWithArtifactPrefixConflict = + Map<ActionAnalysisMetadata, ArtifactPrefixConflictException> actionsWithArtifactPrefixConflict = Actions.findArtifactPrefixConflicts(actionGraph, artifactPathMap); - for (Map.Entry<Action, ArtifactPrefixConflictException> actionExceptionPair : + for (Map.Entry<ActionAnalysisMetadata, ArtifactPrefixConflictException> actionExceptionPair : actionsWithArtifactPrefixConflict.entrySet()) { temporaryBadActionMap.put( actionExceptionPair.getKey(), new ConflictException(actionExceptionPair.getValue())); @@ -240,7 +242,8 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto private static Pair<ActionGraph, SortedMap<PathFragment, Artifact>> constructActionGraphAndPathMap( Iterable<ActionLookupValue> values, - ConcurrentMap<Action, ConflictException> badActionMap) throws InterruptedException { + ConcurrentMap<ActionAnalysisMetadata, ConflictException> badActionMap) + throws InterruptedException { MutableActionGraph actionGraph = new MapBasedActionGraph(); ConcurrentNavigableMap<PathFragment, Artifact> artifactPathMap = new ConcurrentSkipListMap<>(); // Action graph construction is CPU-bound. @@ -274,14 +277,15 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto final List<ActionLookupValue> values, final MutableActionGraph actionGraph, final ConcurrentMap<PathFragment, Artifact> artifactPathMap, - final ConcurrentMap<Action, ConflictException> badActionMap) { + final ConcurrentMap<ActionAnalysisMetadata, ConflictException> badActionMap) { return new Runnable() { @Override public void run() { for (ActionLookupValue value : values) { - Set<Action> registeredActions = new HashSet<>(); - for (Map.Entry<Artifact, Action> entry : value.getMapForConsistencyCheck().entrySet()) { - Action action = entry.getValue(); + Set<ActionAnalysisMetadata> registeredActions = new HashSet<>(); + for (Map.Entry<Artifact, ActionAnalysisMetadata> entry : + value.getMapForConsistencyCheck().entrySet()) { + ActionAnalysisMetadata action = entry.getValue(); // We have an entry for each <action, artifact> pair. Only try to register each action // once. if (registeredActions.add(action)) { diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java index fc00b5760c..140dfbc9db 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java @@ -24,7 +24,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.common.eventbus.EventBus; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.actions.ArtifactFactory; import com.google.devtools.build.lib.actions.ArtifactOwner; import com.google.devtools.build.lib.actions.ArtifactPrefixConflictException; @@ -213,7 +213,8 @@ public final class SkyframeBuildView { } finally { enableAnalysis(false); } - ImmutableMap<Action, ConflictException> badActions = skyframeExecutor.findArtifactConflicts(); + ImmutableMap<ActionAnalysisMetadata, ConflictException> badActions = + skyframeExecutor.findArtifactConflicts(); Collection<AspectValue> goodAspects = Lists.newArrayListWithCapacity(values.size()); NestedSetBuilder<Package> packages = NestedSetBuilder.stableOrder(); @@ -256,7 +257,7 @@ public final class SkyframeBuildView { // TODO(bazel-team): We might want to report the other errors through the event bus but // for keeping this code in parity with legacy we just report the first error for now. if (!keepGoing) { - for (Map.Entry<Action, ConflictException> bad : badActions.entrySet()) { + for (Map.Entry<ActionAnalysisMetadata, ConflictException> bad : badActions.entrySet()) { ConflictException ex = bad.getValue(); try { ex.rethrowTyped(); @@ -339,7 +340,7 @@ public final class SkyframeBuildView { } Collection<Exception> reportedExceptions = Sets.newHashSet(); - for (Map.Entry<Action, ConflictException> bad : badActions.entrySet()) { + for (Map.Entry<ActionAnalysisMetadata, ConflictException> bad : badActions.entrySet()) { ConflictException ex = bad.getValue(); try { ex.rethrowTyped(); 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 25bfc92688..beea6b5054 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 @@ -33,7 +33,7 @@ import com.google.common.collect.ListMultimap; import com.google.common.collect.Maps; import com.google.common.collect.Range; import com.google.common.eventbus.EventBus; -import com.google.devtools.build.lib.actions.Action; +import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; import com.google.devtools.build.lib.actions.ActionCacheChecker; import com.google.devtools.build.lib.actions.ActionExecutionContextFactory; import com.google.devtools.build.lib.actions.ActionExecutionStatusReporter; @@ -634,7 +634,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { artifactFactory.get(), WorkspaceStatusValue.ARTIFACT_OWNER, buildId)); } - public void injectCoverageReportData(ImmutableList<Action> actions) { + public void injectCoverageReportData(ImmutableList<ActionAnalysisMetadata> actions) { PrecomputedValue.COVERAGE_REPORT_KEY.set(injectable(), actions); } @@ -1037,8 +1037,8 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { * {@link SkyframeActionExecutor#findAndStoreArtifactConflicts} to do the work, since any * conflicts found will only be reported during execution. */ - ImmutableMap<Action, SkyframeActionExecutor.ConflictException> findArtifactConflicts() - throws InterruptedException { + ImmutableMap<ActionAnalysisMetadata, SkyframeActionExecutor.ConflictException> + findArtifactConflicts() throws InterruptedException { if (skyframeBuildView.isSomeConfiguredTargetEvaluated() || skyframeBuildView.isSomeConfiguredTargetInvalidated()) { // This operation is somewhat expensive, so we only do it if the graph might have changed in @@ -1384,7 +1384,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { */ public EvaluationResult<PostConfiguredTargetValue> postConfigureTargets( EventHandler eventHandler, List<ConfiguredTargetKey> values, boolean keepGoing, - ImmutableMap<Action, SkyframeActionExecutor.ConflictException> badActions) + ImmutableMap<ActionAnalysisMetadata, SkyframeActionExecutor.ConflictException> badActions) throws InterruptedException { checkActive(); PrecomputedValue.BAD_ACTIONS.set(injectable(), badActions); @@ -1464,7 +1464,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { /** * Returns the generating action of a given artifact ({@code null} if it's a source artifact). */ - private Action getGeneratingAction(EventHandler eventHandler, Artifact artifact) + private ActionAnalysisMetadata getGeneratingAction(EventHandler eventHandler, Artifact artifact) throws InterruptedException { if (artifact.isSourceArtifact()) { return null; @@ -1498,11 +1498,11 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { public ActionGraph getActionGraph(final EventHandler eventHandler) { return new ActionGraph() { @Override - public Action getGeneratingAction(final Artifact artifact) { + public ActionAnalysisMetadata getGeneratingAction(final Artifact artifact) { try { - return callUninterruptibly(new Callable<Action>() { + return callUninterruptibly(new Callable<ActionAnalysisMetadata>() { @Override - public Action call() throws InterruptedException { + public ActionAnalysisMetadata call() throws InterruptedException { return SkyframeExecutor.this.getGeneratingAction(eventHandler, artifact); } }); |