@@ -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
@@ -1407,7 +1407,7 @@ public ActionContinuationOrResult beginExecution(ActionExecutionContext actionEx
1407
1407
ActionExecutionContext spawnContext ;
1408
1408
ShowIncludesFilter showIncludesFilterForStdout ;
1409
1409
ShowIncludesFilter showIncludesFilterForStderr ;
1410
- if (featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES )) {
1410
+ if (shouldParseShowIncludes ( )) {
1411
1411
showIncludesFilterForStdout = new ShowIncludesFilter (getSourceFile ().getFilename ());
1412
1412
showIncludesFilterForStderr = new ShowIncludesFilter (getSourceFile ().getFilename ());
1413
1413
FileOutErr originalOutErr = actionExecutionContext .getFileOutErr ();
@@ -1453,6 +1453,10 @@ protected byte[] getDotDContents(SpawnResult spawnResult) throws EnvironmentalEx
1453
1453
return null ;
1454
1454
}
1455
1455
1456
+ protected boolean shouldParseShowIncludes () {
1457
+ return featureConfiguration .isEnabled (CppRuleClasses .PARSE_SHOWINCLUDES );
1458
+ }
1459
+
1456
1460
protected Spawn createSpawn (Map <String , String > clientEnv ) throws ActionExecutionException {
1457
1461
// Intentionally not adding {@link CppCompileAction#inputsForInvalidation}, those are not needed
1458
1462
// for execution.
@@ -1466,7 +1470,8 @@ protected Spawn createSpawn(Map<String, String> clientEnv) throws ActionExecutio
1466
1470
}
1467
1471
NestedSet <ActionInput > inputs = inputsBuilder .build ();
1468
1472
1469
- ImmutableMap <String , String > executionInfo = getExecutionInfo ();
1473
+ ImmutableMap .Builder <String , String > executionInfo = ImmutableMap .<String , String >builder ()
1474
+ .putAll (getExecutionInfo ());
1470
1475
if (getDotdFile () != null && useInMemoryDotdFiles ()) {
1471
1476
/*
1472
1477
* CppCompileAction does dotd file scanning locally inside the Bazel process and thus
@@ -1476,34 +1481,25 @@ protected Spawn createSpawn(Map<String, String> clientEnv) throws ActionExecutio
1476
1481
* in-memory. We can do that via
1477
1482
* {@link ExecutionRequirements.REMOTE_EXECUTION_INLINE_OUTPUTS}.
1478
1483
*/
1479
- executionInfo =
1480
- ImmutableMap .<String , String >builderWithExpectedSize (executionInfo .size () + 1 )
1481
- .putAll (executionInfo )
1482
- .put (
1483
- ExecutionRequirements .REMOTE_EXECUTION_INLINE_OUTPUTS ,
1484
- getDotdFile ().getExecPathString ())
1485
- .build ();
1484
+ executionInfo .put (ExecutionRequirements .REMOTE_EXECUTION_INLINE_OUTPUTS ,
1485
+ getDotdFile ().getExecPathString ());
1486
1486
}
1487
1487
1488
- if (featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES )) {
1488
+ if (shouldParseShowIncludes ( )) {
1489
1489
// Hack on Windows. The included headers dumped by cl.exe in stdout contain absolute paths.
1490
1490
// When compiling the file from different workspace, the shared cache will cause header
1491
1491
// dependency checking to fail. This was initially fixed by a hack (see
1492
1492
// https://github.com/bazelbuild/bazel/issues/9172 for more details), but is broken again due
1493
1493
// to cl/356735700. We require execution service to ignore caches from other workspace.
1494
- executionInfo =
1495
- ImmutableMap .<String , String >builderWithExpectedSize (executionInfo .size () + 1 )
1496
- .putAll (executionInfo )
1497
- .put (ExecutionRequirements .DIFFERENTIATE_WORKSPACE_CACHE , "" )
1498
- .build ();
1494
+ executionInfo .put (ExecutionRequirements .DIFFERENTIATE_WORKSPACE_CACHE , "" );
1499
1495
}
1500
1496
1501
1497
try {
1502
1498
return new SimpleSpawn (
1503
1499
this ,
1504
1500
ImmutableList .copyOf (getArguments ()),
1505
1501
getEffectiveEnvironment (clientEnv ),
1506
- executionInfo ,
1502
+ executionInfo . build () ,
1507
1503
inputs ,
1508
1504
getOutputs (),
1509
1505
estimateResourceConsumptionLocal ());
@@ -1861,7 +1857,7 @@ public ActionContinuationOrResult execute()
1861
1857
.getOptions (BuildLanguageOptions .class )
1862
1858
.experimentalSiblingRepositoryLayout ;
1863
1859
1864
- if (featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES )) {
1860
+ if (shouldParseShowIncludes ( )) {
1865
1861
NestedSet <Artifact > discoveredInputs =
1866
1862
discoverInputsFromShowIncludesFilters (
1867
1863
execRoot ,
@@ -1901,7 +1897,7 @@ public ActionContinuationOrResult execute()
1901
1897
private void copyTempOutErrToActionOutErr () throws ActionExecutionException {
1902
1898
// If parse_showincludes feature is enabled, instead of parsing dotD file we parse the
1903
1899
// output of cl.exe caused by /showIncludes option.
1904
- if (featureConfiguration . isEnabled ( CppRuleClasses . PARSE_SHOWINCLUDES )) {
1900
+ if (shouldParseShowIncludes ( )) {
1905
1901
try {
1906
1902
FileOutErr tempOutErr = spawnExecutionContext .getFileOutErr ();
1907
1903
FileOutErr outErr = actionExecutionContext .getFileOutErr ();
0 commit comments