diff options
author | Googler <noreply@google.com> | 2018-08-09 11:04:02 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-08-09 11:06:04 -0700 |
commit | dec4e17a98477162ef42ab610b1e94b7cdaaf438 (patch) | |
tree | 1e1173176d1ac2c1580099a28a8d580450e5dec4 /src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java | |
parent | b3b8639098c6b76f0485122160ba60182e950c56 (diff) |
Stop generating .d files when they won't be looked at later.
While at it remove CppCompilationActionBuilder.setAllowUsingHeaderModules,
which isn't used anymore and would make the logic here (even) more complicated.
RELNOTES: None.
PiperOrigin-RevId: 208077525
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java index f281e1bf7e..362ada1878 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java @@ -218,7 +218,8 @@ public class FakeCppCompileAction extends CppCompileAction { outputPrefix + ShellEscaper.escapeString(outputFile.getExecPathString()); } if (input.equals(outputFile.getExecPathString()) - || input.equals(getDotdFile().getSafeExecPath().getPathString())) { + || (getDotdFile() != null + && input.equals(getDotdFile().getSafeExecPath().getPathString()))) { result = outputPrefix + ShellEscaper.escapeString(input); } return result; @@ -231,8 +232,12 @@ public class FakeCppCompileAction extends CppCompileAction { try { // Ensure that the .d file and .o file are siblings, so that the "mkdir" below works for // both. - Preconditions.checkState(outputFile.getExecPath().getParentDirectory().equals( - getDotdFile().getSafeExecPath().getParentDirectory())); + Preconditions.checkState( + getDotdFile() == null + || outputFile + .getExecPath() + .getParentDirectory() + .equals(getDotdFile().getSafeExecPath().getParentDirectory())); FileSystemUtils.writeContent( actionExecutionContext.getInputPath(outputFile), ISO_8859_1, |