diff options
author | 2018-07-19 02:12:31 -0700 | |
---|---|---|
committer | 2018-07-19 02:13:54 -0700 | |
commit | 98670242d308595f9bc689781504176caa2e834b (patch) | |
tree | 39e36acb50213edc1ad9afe810b0ce67958a98e8 /src/main/java/com/google/devtools/build/lib/rules | |
parent | 22aa4e55e309941e179efd6de3c5940c555222a5 (diff) |
Ensure that gathering the info for an extra action can rely on the action
being executed if the action requires input discovery. Input discovery might
actually change the action's command line, which in turn can become part of the
file being written.
RELNOTES: None.
PiperOrigin-RevId: 205207109
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java | 17 |
1 files changed, 12 insertions, 5 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 cfb597ebcd..3068502d38 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 @@ -605,11 +605,18 @@ public class CppCompileAction extends AbstractAction public ExtraActionInfo.Builder getExtraActionInfo(ActionKeyContext actionKeyContext) { CppCompileInfo.Builder info = CppCompileInfo.newBuilder(); info.setTool(compileCommandLine.getToolPath()); - // TODO(djasper): We are getting discovered or transitive modules through the action's inputs - // here. For shorter command lines, we'd prefer to use topLevelModules here, but they are not - // computed in the codepaths leading here. - for (String option : - compileCommandLine.getCompilerOptions(getOverwrittenVariables(getInputs()))) { + + // For actual extra actions, the shadowed action is fully executed and overwrittenVariables get + // computed. However, this function is also used for print_action and there, the action is + // retrieved from the cache, the modules are reconstructed via updateInputs and + // overwrittenVariables don't get computed. + List<String> options = + compileCommandLine.getCompilerOptions( + overwrittenVariables != null + ? overwrittenVariables + : getOverwrittenVariables(getInputs())); + + for (String option : options) { info.addCompilerOption(option); } info.setOutputFile(outputFile.getExecPathString()); |