diff options
author | 2017-03-14 11:24:01 +0000 | |
---|---|---|
committer | 2017-03-14 19:49:56 +0000 | |
commit | 95a4dd0269d95a2a5dc8a952573ef6d83791bbfb (patch) | |
tree | 1b4218c206c2fa45abaf28d0466f9a9d68082bd4 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | |
parent | ae84395a5bee2a04978335f0e08ce714f134d270 (diff) |
A partial, manual rollback of commit 7af14dfdbd6addb779226c0a103b2a8dc72c16b1.
This became necessary because extra actions for C++ compile actions require .h files, but the compiler only returns the .pcm files in the .d file for headers that it reads from the .pcm file. This is not a problem for correctness because the .pcm files depend on the headers, but that doesn't help the extra actions that would then only get the .pcm files.
--
PiperOrigin-RevId: 150052839
MOS_MIGRATED_REVID=150052839
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java index d5b6c8564c..268dbfff6f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java @@ -1231,6 +1231,31 @@ public class CppCompileAction extends AbstractAction } } + /** + * When compiling with modules, the C++ compile action only has the {@code .pcm} files on its + * inputs, which is not enough for extra actions that parse header files. Thus, re-run include + * scanning and add headers to the inputs of the extra action, too. + */ + @Override + public Iterable<Artifact> getInputFilesForExtraAction( + ActionExecutionContext actionExecutionContext) + throws ActionExecutionException, InterruptedException { + Iterable<Artifact> scannedIncludes; + try { + scannedIncludes = actionExecutionContext.getExecutor().getContext(actionContext) + .findAdditionalInputs(this, actionExecutionContext, cppSemantics.getIncludeProcessing()); + } catch (ExecException e) { + throw e.toActionExecutionException(this); + } + + if (scannedIncludes == null) { + return ImmutableList.of(); + } + + return Sets.<Artifact>difference( + ImmutableSet.<Artifact>copyOf(scannedIncludes), ImmutableSet.<Artifact>copyOf(getInputs())); + } + @Override public String getMnemonic() { if (CppFileTypes.OBJC_SOURCE.matches(sourceFile.getExecPath()) |