@@ -386,7 +386,7 @@ public void clearAdditionalInputs() {
386
386
public boolean discoversInputs () {
387
387
return shouldScanIncludes
388
388
|| getDotdFile () != null
389
- || featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES );
389
+ || shouldParseShowIncludes ( );
390
390
}
391
391
392
392
@ Override
@@ -1399,7 +1399,7 @@ public ActionContinuationOrResult beginExecution(ActionExecutionContext actionEx
1399
1399
ActionExecutionContext spawnContext ;
1400
1400
ShowIncludesFilter showIncludesFilterForStdout ;
1401
1401
ShowIncludesFilter showIncludesFilterForStderr ;
1402
- if (featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES )) {
1402
+ if (shouldParseShowIncludes ( )) {
1403
1403
showIncludesFilterForStdout = new ShowIncludesFilter (getSourceFile ().getFilename ());
1404
1404
showIncludesFilterForStderr = new ShowIncludesFilter (getSourceFile ().getFilename ());
1405
1405
FileOutErr originalOutErr = actionExecutionContext .getFileOutErr ();
@@ -1445,6 +1445,10 @@ protected byte[] getDotDContents(SpawnResult spawnResult) throws EnvironmentalEx
1445
1445
return null ;
1446
1446
}
1447
1447
1448
+ protected boolean shouldParseShowIncludes () {
1449
+ return featureConfiguration .isEnabled (CppRuleClasses .PARSE_SHOWINCLUDES );
1450
+ }
1451
+
1448
1452
protected Spawn createSpawn (Map <String , String > clientEnv ) throws ActionExecutionException {
1449
1453
// Intentionally not adding {@link CppCompileAction#inputsForInvalidation}, those are not needed
1450
1454
// for execution.
@@ -1458,7 +1462,8 @@ protected Spawn createSpawn(Map<String, String> clientEnv) throws ActionExecutio
1458
1462
}
1459
1463
NestedSet <ActionInput > inputs = inputsBuilder .build ();
1460
1464
1461
- ImmutableMap <String , String > executionInfo = getExecutionInfo ();
1465
+ ImmutableMap .Builder <String , String > executionInfo = ImmutableMap .<String , String >builder ()
1466
+ .putAll (getExecutionInfo ());
1462
1467
if (getDotdFile () != null && useInMemoryDotdFiles ()) {
1463
1468
/*
1464
1469
* CppCompileAction does dotd file scanning locally inside the Bazel process and thus
@@ -1468,34 +1473,25 @@ protected Spawn createSpawn(Map<String, String> clientEnv) throws ActionExecutio
1468
1473
* in-memory. We can do that via
1469
1474
* {@link ExecutionRequirements.REMOTE_EXECUTION_INLINE_OUTPUTS}.
1470
1475
*/
1471
- executionInfo =
1472
- ImmutableMap .<String , String >builderWithExpectedSize (executionInfo .size () + 1 )
1473
- .putAll (executionInfo )
1474
- .put (
1475
- ExecutionRequirements .REMOTE_EXECUTION_INLINE_OUTPUTS ,
1476
- getDotdFile ().getExecPathString ())
1477
- .build ();
1476
+ executionInfo .put (ExecutionRequirements .REMOTE_EXECUTION_INLINE_OUTPUTS ,
1477
+ getDotdFile ().getExecPathString ());
1478
1478
}
1479
1479
1480
- if (featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES )) {
1480
+ if (shouldParseShowIncludes ( )) {
1481
1481
// Hack on Windows. The included headers dumped by cl.exe in stdout contain absolute paths.
1482
1482
// When compiling the file from different workspace, the shared cache will cause header
1483
1483
// dependency checking to fail. This was initially fixed by a hack (see
1484
1484
// https://github.com/bazelbuild/bazel/issues/9172 for more details), but is broken again due
1485
1485
// to cl/356735700. We require execution service to ignore caches from other workspace.
1486
- executionInfo =
1487
- ImmutableMap .<String , String >builderWithExpectedSize (executionInfo .size () + 1 )
1488
- .putAll (executionInfo )
1489
- .put (ExecutionRequirements .DIFFERENTIATE_WORKSPACE_CACHE , "" )
1490
- .build ();
1486
+ executionInfo .put (ExecutionRequirements .DIFFERENTIATE_WORKSPACE_CACHE , "" );
1491
1487
}
1492
1488
1493
1489
try {
1494
1490
return new SimpleSpawn (
1495
1491
this ,
1496
1492
ImmutableList .copyOf (getArguments ()),
1497
1493
getEnvironment (clientEnv ),
1498
- executionInfo ,
1494
+ executionInfo . build () ,
1499
1495
inputs ,
1500
1496
getOutputs (),
1501
1497
estimateResourceConsumptionLocal ());
@@ -1848,7 +1844,7 @@ public ActionContinuationOrResult execute()
1848
1844
.getOptions (BuildLanguageOptions .class )
1849
1845
.experimentalSiblingRepositoryLayout ;
1850
1846
1851
- if (featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES )) {
1847
+ if (shouldParseShowIncludes ( )) {
1852
1848
NestedSet <Artifact > discoveredInputs =
1853
1849
discoverInputsFromShowIncludesFilters (
1854
1850
execRoot ,
@@ -1888,7 +1884,7 @@ public ActionContinuationOrResult execute()
1888
1884
private void copyTempOutErrToActionOutErr () throws ActionExecutionException {
1889
1885
// If parse_showincludes feature is enabled, instead of parsing dotD file we parse the
1890
1886
// output of cl.exe caused by /showIncludes option.
1891
- if (featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES )) {
1887
+ if (shouldParseShowIncludes ( )) {
1892
1888
try {
1893
1889
FileOutErr tempOutErr = spawnExecutionContext .getFileOutErr ();
1894
1890
FileOutErr outErr = actionExecutionContext .getFileOutErr ();
0 commit comments