1818import com .google .common .collect .ImmutableList ;
1919import com .google .common .util .concurrent .ListenableFuture ;
2020import com .google .devtools .build .lib .actions .ActionExecutionMetadata ;
21- import com .google .devtools .build .lib .actions .ActionInput ;
2221import com .google .devtools .build .lib .actions .ActionInputPrefetcher ;
2322import com .google .devtools .build .lib .actions .Actions ;
2423import com .google .devtools .build .lib .actions .Artifact ;
2524import com .google .devtools .build .lib .actions .Artifact .DerivedArtifact ;
25+ import com .google .devtools .build .lib .actions .Artifact .TreeFileArtifact ;
2626import com .google .devtools .build .lib .actions .FileArtifactValue ;
2727import com .google .devtools .build .lib .actions .ImportantOutputHandler ;
2828import com .google .devtools .build .lib .actions .InputMetadataProvider ;
@@ -152,7 +152,7 @@ private void downloadArtifact(
152152 return ;
153153 }
154154
155- var filesToDownload = new ArrayList <ActionInput >(treeArtifactValue .getChildren ().size ());
155+ var filesToDownload = new ArrayList <TreeFileArtifact >(treeArtifactValue .getChildren ().size ());
156156 for (var entry : treeArtifactValue .getChildValues ().entrySet ()) {
157157 if (remoteOutputChecker .shouldDownloadOutput (entry .getKey (), entry .getValue ())) {
158158 filesToDownload .add (entry .getKey ());
@@ -161,7 +161,9 @@ private void downloadArtifact(
161161 if (!filesToDownload .isEmpty ()) {
162162 futures .add (
163163 actionInputPrefetcher .prefetchFiles (
164- getGeneratingAction ((DerivedArtifact ) filesToDownload .getFirst ()),
164+ // derivedArtifact's generating action may be an action template, which doesn't
165+ // implement the required ActionExecutionMetadata.
166+ getGeneratingAction (filesToDownload .getFirst ()),
165167 filesToDownload ,
166168 metadataProvider ,
167169 ActionInputPrefetcher .Priority .LOW ,
@@ -190,8 +192,9 @@ private ActionExecutionMetadata getGeneratingAction(DerivedArtifact artifact)
190192 var action = Actions .getGeneratingAction (graph , artifact );
191193 Preconditions .checkState (
192194 action instanceof ActionExecutionMetadata ,
193- "generating action for artifact %s is not an ActionExecutionMetadata" ,
194- artifact );
195+ "generating action for artifact %s is not an ActionExecutionMetadata, but %s" ,
196+ artifact ,
197+ action != null ? action .getClass () : null );
195198 return (ActionExecutionMetadata ) action ;
196199 }
197200}
0 commit comments