diff options
author | Reid Kleckner <rnk@google.com> | 2013-08-19 23:44:30 (GMT) |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2013-08-19 23:44:30 (GMT) |
commit | 0402cab0776e0bf3db5705fd02f0f860a4e1864c (patch) | |
tree | 39fc58b21b5137d37cb8fb685b70351e814fecbd | |
parent | 808ba411d4484617363b79f175569d6ae2f86c01 (diff) | |
parent | 40b51a0b986b8675e15b0cd1b10c272bf51fdb84 (diff) | |
download | Ninja-0402cab0776e0bf3db5705fd02f0f860a4e1864c.zip Ninja-0402cab0776e0bf3db5705fd02f0f860a4e1864c.tar.gz Ninja-0402cab0776e0bf3db5705fd02f0f860a4e1864c.tar.bz2 |
Merge branch 'master' into wstr
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | doc/manual.asciidoc | 2 | ||||
-rw-r--r-- | platform_helper.py | 5 | ||||
-rw-r--r-- | src/build.cc | 5 | ||||
-rw-r--r-- | src/build.h | 2 | ||||
-rw-r--r-- | src/graph_test.cc | 20 | ||||
-rw-r--r-- | src/ninja.cc | 5 |
7 files changed, 39 insertions, 8 deletions
@@ -15,8 +15,16 @@ TAGS /doc/manual.html /doc/doxygen /gtest-1.6.0 +*.patch # Eclipse project files .project .cproject +# SublimeText project files +*.sublime-project +*.sublime-workspace + +# Ninja output +.ninja_deps +.ninja_log diff --git a/doc/manual.asciidoc b/doc/manual.asciidoc index 2900f28..a735257 100644 --- a/doc/manual.asciidoc +++ b/doc/manual.asciidoc @@ -54,7 +54,7 @@ Here are the design goals of Ninja: higher-level build systems have different opinions about how code should be built; for example, should built objects live alongside the sources or should all build output go into a separate directory? - Is there an "package" rule that builds a distributable package of + Is there a "package" rule that builds a distributable package of the project? Sidestep these decisions by trying to allow either to be implemented, rather than choosing, even if that results in more verbosity. diff --git a/platform_helper.py b/platform_helper.py index e615660..b7447a1 100644 --- a/platform_helper.py +++ b/platform_helper.py @@ -41,9 +41,8 @@ class Platform( object ): self._platform = 'mingw' elif self._platform.startswith('win'): self._platform = 'msvc' - elif self._platform.startswith('bitrig'): - self._platform = 'bitrig' - + elif self._platform.startswith('bitrig'): + self._platform = 'bitrig' def platform(self): return self._platform diff --git a/src/build.cc b/src/build.cc index 45f6849..6d23f3b 100644 --- a/src/build.cc +++ b/src/build.cc @@ -362,8 +362,11 @@ void Plan::ResumeDelayedJobs(Edge* edge) { void Plan::EdgeFinished(Edge* edge) { map<Edge*, bool>::iterator i = want_.find(edge); assert(i != want_.end()); - if (i->second) + if (i->second) { --wanted_edges_; + if (!edge->is_phony()) + --command_edges_; + } want_.erase(i); edge->outputs_ready_ = true; diff --git a/src/build.h b/src/build.h index 33df7d0..a872f6c 100644 --- a/src/build.h +++ b/src/build.h @@ -51,7 +51,7 @@ struct Plan { Edge* FindWork(); /// Returns true if there's more work to be done. - bool more_to_do() const { return wanted_edges_; } + bool more_to_do() const { return (command_edges_ > 0); } /// Dumps the current state of the plan. void Dump(); diff --git a/src/graph_test.cc b/src/graph_test.cc index 63d5757..8521216 100644 --- a/src/graph_test.cc +++ b/src/graph_test.cc @@ -13,6 +13,7 @@ // limitations under the License. #include "graph.h" +#include "build.h" #include "test.h" @@ -226,3 +227,22 @@ TEST_F(GraphTest, DepfileOverrideParent) { Edge* edge = GetNode("out")->in_edge(); EXPECT_EQ("depfile is y", edge->GetBinding("command")); } + +// Verify that building a nested phony rule prints "no work to do" +TEST_F(GraphTest, NestedPhonyPrintsDone) { + AssertParse(&state_, +"build n1: phony \n" +"build n2: phony n1\n" + ); + string err; + Edge* edge = GetNode("n2")->in_edge(); + EXPECT_TRUE(scan_.RecomputeDirty(edge, &err)); + ASSERT_EQ("", err); + + Plan plan_; + EXPECT_TRUE(plan_.AddTarget(GetNode("n2"), &err)); + ASSERT_EQ("", err); + + EXPECT_EQ(0, plan_.command_edge_count()); + ASSERT_FALSE(plan_.more_to_do()); +} diff --git a/src/ninja.cc b/src/ninja.cc index 80d68e7..0586bdc 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -1006,6 +1006,7 @@ int real_main(int argc, char** argv) { options.input_file = "build.ninja"; setvbuf(stdout, NULL, _IOLBF, BUFSIZ); + const char* ninja_command = argv[0]; int exit_code = ReadFlags(&argc, &argv, &options, &config); if (exit_code >= 0) @@ -1014,7 +1015,7 @@ int real_main(int argc, char** argv) { if (options.tool && options.tool->when == Tool::RUN_AFTER_FLAGS) { // None of the RUN_AFTER_FLAGS actually use a NinjaMain, but it's needed // by other tools. - NinjaMain ninja(argv[0], config); + NinjaMain ninja(ninja_command, config); return (ninja.*options.tool->func)(argc, argv); } @@ -1034,7 +1035,7 @@ int real_main(int argc, char** argv) { // The build can take up to 2 passes: one to rebuild the manifest, then // another to build the desired target. for (int cycle = 0; cycle < 2; ++cycle) { - NinjaMain ninja(argv[0], config); + NinjaMain ninja(ninja_command, config); RealFileReader file_reader; ManifestParser parser(&ninja.state_, &file_reader); |