diff options
author | 2018-03-07 05:57:37 -0800 | |
---|---|---|
committer | 2018-03-07 05:59:04 -0800 | |
commit | 2f232c8078d241f61947878d4a67989e3c8884e8 (patch) | |
tree | 9eb8eeecb8ccd24eb16c14807704cb6cb2f3309d /src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java | |
parent | e5626a53e108fe9de2af84fb2cf0c38eb72cdc4f (diff) |
Add option to dump command lines of actions in dump.
RELNOTES: None
PiperOrigin-RevId: 188164754
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java index 2400cf6d18..a9fba24573 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/DumpCommand.java @@ -16,6 +16,7 @@ package com.google.devtools.build.lib.runtime.commands; import static java.util.stream.Collectors.toList; +import com.google.devtools.build.lib.actions.CommandLineExpansionException; import com.google.devtools.build.lib.analysis.AnalysisProtos.ActionGraphContainer; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.ExtendedEventHandler; @@ -128,6 +129,18 @@ public class DumpCommand implements BlazeCommand { public List<String> actionGraphTargets; @Option( + name = "action_graph:include_cmdline", + defaultValue = "false", + category = "verbosity", + documentationCategory = OptionDocumentationCategory.OUTPUT_SELECTION, + effectTags = {OptionEffectTag.BAZEL_MONITORING}, + help = + "Include command line of actions in the action graph dump. " + + "This option does only apply to --action_graph." + ) + public boolean actionGraphIncludeCmdLine; + + @Option( name = "rule_classes", defaultValue = "false", category = "verbosity", @@ -251,7 +264,10 @@ public class DumpCommand implements BlazeCommand { env.getSkyframeExecutor(), dumpOptions.dumpActionGraph, dumpOptions.actionGraphTargets, + dumpOptions.actionGraphIncludeCmdLine, out); + } catch (CommandLineExpansionException e) { + env.getReporter().handle(Event.error(null, "Error expanding command line: " + e)); } catch (IOException e) { env.getReporter() .error( @@ -303,11 +319,15 @@ public class DumpCommand implements BlazeCommand { } private boolean dumpActionGraph( - SkyframeExecutor executor, String path, List<String> actionGraphTargets, PrintStream out) - throws IOException { + SkyframeExecutor executor, + String path, + List<String> actionGraphTargets, + boolean includeActionCmdLine, + PrintStream out) + throws CommandLineExpansionException, IOException { out.println("Dumping action graph to '" + path + "'"); ActionGraphContainer actionGraphContainer = - executor.getActionGraphContainer(actionGraphTargets); + executor.getActionGraphContainer(actionGraphTargets, includeActionCmdLine); FileOutputStream protoOutputStream = new FileOutputStream(path); actionGraphContainer.writeTo(protoOutputStream); protoOutputStream.close(); |