From 8a41be90cf24258db14a8ca1be7c4334d0076dd5 Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 19 Apr 2023 06:49:46 -0700 Subject: [PATCH] Check for the nullness of AspectValue. This should have been included in unknown commit (which added the same check for text output). FIXES #15716. PiperOrigin-RevId: 525434548 Change-Id: I5fc80fa1f81ccf5f7b0d8b5d826d8418e2239306 --- .../aquery/ConfiguredTargetValueAccessor.java | 5 ++--- .../skyframe/actiongraph/v2/ActionGraphDump.java | 13 +++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/query2/aquery/ConfiguredTargetValueAccessor.java b/src/main/java/com/google/devtools/build/lib/query2/aquery/ConfiguredTargetValueAccessor.java index d2dddfdee7e626..49eee82d586457 100644 --- a/src/main/java/com/google/devtools/build/lib/query2/aquery/ConfiguredTargetValueAccessor.java +++ b/src/main/java/com/google/devtools/build/lib/query2/aquery/ConfiguredTargetValueAccessor.java @@ -37,7 +37,6 @@ import com.google.devtools.build.skyframe.SkyFunctionName; import com.google.devtools.build.skyframe.SkyKey; import com.google.devtools.build.skyframe.WalkableGraph; -import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -162,8 +161,8 @@ private Target getTargetFromConfiguredTargetValue( } /** Returns the AspectValues that are attached to the given configuredTarget. */ - public Collection getAspectValues( - KeyedConfiguredTargetValue keyedConfiguredTargetValue) throws InterruptedException { + public Set getAspectValues(KeyedConfiguredTargetValue keyedConfiguredTargetValue) + throws InterruptedException { Set result = new HashSet<>(); SkyKey skyKey = configuredTargetKeyExtractor.extractKey(keyedConfiguredTargetValue); Iterable revDeps = diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/actiongraph/v2/ActionGraphDump.java b/src/main/java/com/google/devtools/build/lib/skyframe/actiongraph/v2/ActionGraphDump.java index 773240fc366a1e..189846192157ed 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/actiongraph/v2/ActionGraphDump.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/actiongraph/v2/ActionGraphDump.java @@ -285,9 +285,18 @@ private void dumpSingleAction(ConfiguredTarget configuredTarget, ActionAnalysisM aqueryOutputHandler.outputAction(actionBuilder.build()); } - public void dumpAspect(AspectValue aspectValue, ConfiguredTargetValue configuredTargetValue) - throws CommandLineExpansionException, InterruptedException, IOException, + public void dumpAspect( + @Nullable AspectValue aspectValue, ConfiguredTargetValue configuredTargetValue) + throws CommandLineExpansionException, + InterruptedException, + IOException, TemplateExpansionException { + // It's possible for a value from a previous build on the same server to be missing + // e.g. after having cleared the analysis cache. + if (aspectValue == null) { + return; + } + ConfiguredTarget configuredTarget = configuredTargetValue.getConfiguredTarget(); if (!includeInActionGraph(configuredTarget.getLabel().toString())) { return;