summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-09 15:50:25 (GMT)
committerEvan Martin <martine@danga.com>2011-05-09 15:50:46 (GMT)
commit18a9a3d98b0449061c3cdcb4646ada71cd2fa8eb (patch)
tree6058c6ec8212302ed3e3552050fc586944d93a5a
parent4e9f273d9c4a2d19ad15169ff1f244c4b1e7bbd1 (diff)
downloadNinja-18a9a3d98b0449061c3cdcb4646ada71cd2fa8eb.zip
Ninja-18a9a3d98b0449061c3cdcb4646ada71cd2fa8eb.tar.gz
Ninja-18a9a3d98b0449061c3cdcb4646ada71cd2fa8eb.tar.bz2
expose -k flag to users
-rw-r--r--src/build.cc5
-rw-r--r--src/ninja.cc9
2 files changed, 12 insertions, 2 deletions
diff --git a/src/build.cc b/src/build.cc
index 2a280e0..7f7ae6d 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -431,7 +431,10 @@ bool Builder::Build(string* err) {
if (Edge* edge = command_runner_->NextFinishedCommand(&success)) {
if (!success) {
if (--failures_allowed < 0) {
- *err = "subcommand failed";
+ if (config_.swallow_failures > 0)
+ *err = "subcommands failed";
+ else
+ *err = "subcommand failed";
return false;
}
} else {
diff --git a/src/ninja.cc b/src/ninja.cc
index 26b6e5e..8b4206c 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -57,6 +57,7 @@ void usage(const BuildConfig& config) {
"options:\n"
" -f FILE specify input build file [default=build.ninja]\n"
" -j N run N jobs in parallel [default=%d]\n"
+" -k N keep going until N jobs fail [default=1]\n"
" -n dry run (don't run commands but pretend they succeeded)\n"
" -v show all command lines\n"
" -C DIR change to DIR before doing anything else\n"
@@ -350,7 +351,8 @@ int main(int argc, char** argv) {
config.parallelism = GuessParallelism();
int opt;
- while ((opt = getopt_long(argc, argv, "f:hj:nt:vC:", options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "f:hj:k:nt:vC:", options,
+ NULL)) != -1) {
switch (opt) {
case 'f':
input_file = optarg;
@@ -358,6 +360,11 @@ int main(int argc, char** argv) {
case 'j':
config.parallelism = atoi(optarg);
break;
+ case 'k':
+ // We want to go until N jobs fail, which means we should ignore
+ // the first N-1 that fail and then stop.
+ config.swallow_failures = atoi(optarg) - 1;
+ break;
case 'n':
config.dry_run = true;
break;