@@ -3445,17 +3445,21 @@ public boolean hasDiffAwareness() {
3445
3445
return diffAwarenessManager != null ;
3446
3446
}
3447
3447
3448
+ @ VisibleForTesting
3449
+ public void handleDiffsForTesting (ExtendedEventHandler eventHandler ) throws InterruptedException , AbruptExitException {
3450
+ handleDiffsForTesting (eventHandler , Options .getDefaults (PackageOptions .class ));
3451
+ }
3452
+
3448
3453
/** Uses diff awareness on all the package paths to invalidate changed files. */
3449
3454
@ VisibleForTesting
3450
- public void handleDiffsForTesting (ExtendedEventHandler eventHandler )
3455
+ public void handleDiffsForTesting (ExtendedEventHandler eventHandler , PackageOptions packageOptions )
3451
3456
throws InterruptedException , AbruptExitException {
3452
3457
if (lastAnalysisDiscarded ) {
3453
3458
// Values were cleared last build, but they couldn't be deleted because they were needed for
3454
3459
// the execution phase. We can delete them now.
3455
3460
dropConfiguredTargetsNow (eventHandler );
3456
3461
lastAnalysisDiscarded = false ;
3457
3462
}
3458
- PackageOptions packageOptions = Options .getDefaults (PackageOptions .class );
3459
3463
packageOptions .checkOutputFiles = false ;
3460
3464
ClassToInstanceMap <OptionsBase > options =
3461
3465
ImmutableClassToInstanceMap .of (PackageOptions .class , packageOptions );
@@ -3558,12 +3562,14 @@ protected WorkspaceInfoFromDiff handleDiffs(
3558
3562
}
3559
3563
RepositoryOptions repoOptions = options .getOptions (RepositoryOptions .class );
3560
3564
try (SilentCloseable c = Profiler .instance ().profile ("handleDiffsWithMissingDiffInformation" )) {
3565
+ PackageOptions packageOptions = options .getOptions (PackageOptions .class );
3561
3566
handleDiffsWithMissingDiffInformation (
3562
3567
eventHandler ,
3563
3568
tsgm ,
3564
3569
pathEntriesWithoutDiffInformation ,
3565
- options .getOptions (PackageOptions .class ).checkOutputFiles ,
3566
- repoOptions != null && repoOptions .checkExternalRepositoryFiles ,
3570
+ packageOptions .checkOutputFiles ,
3571
+ repoOptions != null && repoOptions .checkExternalRepositoryFiles ,
3572
+ packageOptions .checkNonOutputExternalFiles ,
3567
3573
fsvcThreads );
3568
3574
}
3569
3575
handleClientEnvironmentChanges ();
@@ -3640,6 +3646,7 @@ protected void handleDiffsWithMissingDiffInformation(
3640
3646
Set <Pair <Root , ProcessableModifiedFileSet >> pathEntriesWithoutDiffInformation ,
3641
3647
boolean checkOutputFiles ,
3642
3648
boolean checkExternalRepositoryFiles ,
3649
+ boolean checkNonoutputExternalFiles ,
3643
3650
int fsvcThreads )
3644
3651
throws InterruptedException , AbruptExitException {
3645
3652
@@ -3692,8 +3699,8 @@ protected void handleDiffsWithMissingDiffInformation(
3692
3699
if (checkExternalRepositoryFiles ) {
3693
3700
fileTypesToCheck = EnumSet .of (FileType .EXTERNAL_REPO );
3694
3701
}
3695
- if (externalFilesKnowledge .tooManyNonOutputExternalFilesSeen
3696
- || !externalFilesKnowledge .nonOutputExternalFilesSeen .isEmpty ()) {
3702
+ if (checkNonoutputExternalFiles && ( externalFilesKnowledge .tooManyNonOutputExternalFilesSeen
3703
+ || !externalFilesKnowledge .nonOutputExternalFilesSeen .isEmpty ())) {
3697
3704
fileTypesToCheck .add (FileType .EXTERNAL );
3698
3705
}
3699
3706
// See the comment for FileType.OUTPUT for why we need to consider output files here.
@@ -3727,8 +3734,8 @@ protected void handleDiffsWithMissingDiffInformation(
3727
3734
// once an external file gets into the Skyframe graph, we'll overly-conservatively always
3728
3735
// think the graph needs to be scanned.
3729
3736
externalFilesHelper .setExternalFilesKnowledge (
3730
- tmpExternalFilesHelper .getExternalFilesKnowledge ());
3731
- } else if (!externalFilesKnowledge .nonOutputExternalFilesSeen .isEmpty ()) {
3737
+ tmpExternalFilesHelper .getExternalFilesKnowledge ());
3738
+ } else if (checkNonoutputExternalFiles && !externalFilesKnowledge .nonOutputExternalFilesSeen .isEmpty ()) {
3732
3739
logger .atInfo ().log (
3733
3740
"About to scan %d external files" ,
3734
3741
externalFilesKnowledge .nonOutputExternalFilesSeen .size ());
0 commit comments