summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-10-05 21:17:56 (GMT)
committerColin Cross <ccross@android.com>2015-10-05 22:43:27 (GMT)
commit33b3480d82057a01de8f8de5671046c26c88db4b (patch)
treedde87a06981bf3e7315989128299b399b96ef76d /src
parenta48434493d69085aa6fc0c002180ace555cad592 (diff)
downloadNinja-33b3480d82057a01de8f8de5671046c26c88db4b.zip
Ninja-33b3480d82057a01de8f8de5671046c26c88db4b.tar.gz
Ninja-33b3480d82057a01de8f8de5671046c26c88db4b.tar.bz2
Print output file on failure
Modify the FAILED: output to provide the output files that failed to build, followed by the failed command on the next line. This makes the failure much easier to read, as you can immediately see much shorter name of the file that failed instead of trying to parse a very long command line. It also makes manually re-running the failed command much easier because you can copy the whole line without ending up with the FAILED: prefix.
Diffstat (limited to 'src')
-rw-r--r--src/build.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/build.cc b/src/build.cc
index e4820d0..8865a1d 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -125,8 +125,15 @@ void BuildStatus::BuildEdgeFinished(Edge* edge,
PrintStatus(edge);
// Print the command that is spewing before printing its output.
- if (!success)
- printer_.PrintOnNewLine("FAILED: " + edge->EvaluateCommand() + "\n");
+ if (!success) {
+ string outputs;
+ for (vector<Node*>::const_iterator o = edge->outputs_.begin();
+ o != edge->outputs_.end(); ++o)
+ outputs += (*o)->path() + " ";
+
+ printer_.PrintOnNewLine("FAILED: " + outputs + "\n");
+ printer_.PrintOnNewLine(edge->EvaluateCommand() + "\n");
+ }
if (!output.empty()) {
// ninja sets stdout and stderr of subprocesses to a pipe, to be able to