@@ -378,9 +378,9 @@ private ListenableFuture<Void> prefetchFile(
378
378
379
379
PathFragment execPath = input .getExecPath ();
380
380
381
- // Metadata may legitimately be missing, e.g. if this is an optional test output.
382
381
FileArtifactValue metadata = metadataSupplier .getMetadata (input );
383
382
if (metadata == null || !canDownloadFile (execRoot .getRelative (execPath ), metadata )) {
383
+ // Metadata may legitimately be missing, e.g. if this is an optional spawn output.
384
384
return immediateVoidFuture ();
385
385
}
386
386
@@ -441,19 +441,12 @@ private PathFragment maybeGetTreeRoot(ActionInput input, MetadataSupplier metada
441
441
}
442
442
SpecialArtifact treeArtifact = treeFile .getParent ();
443
443
FileArtifactValue treeMetadata = metadataSupplier .getMetadata (treeArtifact );
444
- if (treeMetadata == null ) {
445
- // There are two cases where tree metadata is legitimately not available:
446
- // (1) If the file is the output of an action expanded from an action template. In this
447
- // case, the symlink optimization is intentionally not supported.
448
- // (2) If the file is part of an input fileset. In this case, a symlink has already been
449
- // created, but we're currently unable to prefetch the file(s) it points to.
450
- // TODO: b/401575099 - Treating fileset more like runfiles could make the tree metadata
451
- // available for case (2).
452
- return null ;
453
- }
454
- PathFragment resolvedPath = treeMetadata .getResolvedPath ();
455
- if (resolvedPath != null ) {
456
- return resolvedPath .relativeTo (execRoot .asFragment ());
444
+ // Metadata may legitimately be missing, e.g. if this is an optional spawn output.
445
+ if (treeMetadata != null ) {
446
+ PathFragment resolvedPath = treeMetadata .getResolvedPath ();
447
+ if (resolvedPath != null ) {
448
+ return resolvedPath .relativeTo (execRoot .asFragment ());
449
+ }
457
450
}
458
451
return treeArtifact .getExecPath ();
459
452
}
@@ -468,24 +461,15 @@ private PathFragment maybeGetTreeRoot(ActionInput input, MetadataSupplier metada
468
461
*/
469
462
@ Nullable
470
463
private Symlink maybeGetSymlink (
471
- ActionInput input ,
472
- FileArtifactValue metadata ,
473
- MetadataSupplier metadataSupplier )
464
+ ActionInput input , FileArtifactValue metadata , MetadataSupplier metadataSupplier )
474
465
throws IOException , InterruptedException {
475
466
if (input instanceof TreeFileArtifact treeFile ) {
476
467
SpecialArtifact treeArtifact = treeFile .getParent ();
477
468
FileArtifactValue treeMetadata = metadataSupplier .getMetadata (treeArtifact );
478
- if (treeMetadata == null ) {
479
- // There are two cases where tree metadata is legitimately not available:
480
- // (1) If the file is the output of an action expanded from an action template. In this
481
- // case, the symlink optimization is intentionally not supported.
482
- // (2) If the file is part of an input fileset. In this case, a symlink has already been
483
- // created, but we're currently unable to prefetch the file(s) it points to.
484
- // TODO: b/401575099 - Treating fileset more like runfiles could make the tree metadata
485
- // available for case (2).
486
- return null ;
469
+ // Metadata may legitimately be missing, e.g. if this is an optional spawn output.
470
+ if (treeMetadata != null ) {
471
+ return maybeGetSymlink (treeArtifact , treeMetadata , metadataSupplier );
487
472
}
488
- return maybeGetSymlink (treeArtifact , treeMetadata , metadataSupplier );
489
473
}
490
474
PathFragment execPath = input .getExecPath ();
491
475
PathFragment resolvedExecPath = execPath ;
0 commit comments