summaryrefslogtreecommitdiffstats
path: root/src/ninja.cc
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-06-29 21:17:37 (GMT)
committerNico Weber <nicolasweber@gmx.de>2014-06-29 21:17:37 (GMT)
commit54e58818b49b337867b79fa643b6e7d075b259ee (patch)
tree3dae86bf704173e4839e3d923881426b7626fdac /src/ninja.cc
parent5011595b8c17a86f91fb248c5fabd87c66600e0b (diff)
parent86c4b0618bf714367096c8b7661bde068b02e8fa (diff)
downloadNinja-54e58818b49b337867b79fa643b6e7d075b259ee.zip
Ninja-54e58818b49b337867b79fa643b6e7d075b259ee.tar.gz
Ninja-54e58818b49b337867b79fa643b6e7d075b259ee.tar.bz2
Merge pull request #755 from zmodem/working_dir_vs_msvc_tool
Process the -C option before running RUN_AFTER_FLAGS tools.
Diffstat (limited to 'src/ninja.cc')
-rw-r--r--src/ninja.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index a381e83..5dfcbf4 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -163,7 +163,8 @@ struct Tool {
/// When to run the tool.
enum {
- /// Run after parsing the command-line flags (as early as possible).
+ /// Run after parsing the command-line flags and potentially changing
+ /// the current working directory (as early as possible).
RUN_AFTER_FLAGS,
/// Run after loading build.ninja.
@@ -1042,13 +1043,6 @@ int real_main(int argc, char** argv) {
if (exit_code >= 0)
return exit_code;
- 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(ninja_command, config);
- return (ninja.*options.tool->func)(argc, argv);
- }
-
if (options.working_dir) {
// The formatting of this string, complete with funny quotes, is
// so Emacs can properly identify that the cwd has changed for
@@ -1062,6 +1056,13 @@ 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(ninja_command, config);
+ return (ninja.*options.tool->func)(argc, 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) {