diff options
author | Colin Cross <ccross@android.com> | 2016-03-07 21:37:11 (GMT) |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-04-19 20:34:16 (GMT) |
commit | bff4010e561b7d5f366262ef3d1415dcd50a3d94 (patch) | |
tree | 99c4675151f594f9182629871916b2adaf2a3946 /src/ninja.cc | |
parent | bfe8cd9b34d117201ffecd639e4b694f18648242 (diff) | |
download | Ninja-bff4010e561b7d5f366262ef3d1415dcd50a3d94.zip Ninja-bff4010e561b7d5f366262ef3d1415dcd50a3d94.tar.gz Ninja-bff4010e561b7d5f366262ef3d1415dcd50a3d94.tar.bz2 |
Pass location of build.ninja file to browse script
Pass the value of -f to the browse python script so it can be passed
back to ninja -t query.
Diffstat (limited to 'src/ninja.cc')
-rw-r--r-- | src/ninja.cc | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/ninja.cc b/src/ninja.cc index b3b9bed..25eafe8 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -97,7 +97,7 @@ struct NinjaMain : public BuildLogUser { DepsLog deps_log_; /// The type of functions that are the entry points to tools (subcommands). - typedef int (NinjaMain::*ToolFunc)(int, char**); + typedef int (NinjaMain::*ToolFunc)(const Options*, int, char**); /// Get the Node for a given command-line path, handling features like /// spell correction. @@ -108,17 +108,17 @@ struct NinjaMain : public BuildLogUser { vector<Node*>* targets, string* err); // The various subcommands, run via "-t XXX". - int ToolGraph(int argc, char* argv[]); - int ToolQuery(int argc, char* argv[]); - int ToolDeps(int argc, char* argv[]); - int ToolBrowse(int argc, char* argv[]); - int ToolMSVC(int argc, char* argv[]); - int ToolTargets(int argc, char* argv[]); - int ToolCommands(int argc, char* argv[]); - int ToolClean(int argc, char* argv[]); - int ToolCompilationDatabase(int argc, char* argv[]); - int ToolRecompact(int argc, char* argv[]); - int ToolUrtle(int argc, char** argv); + int ToolGraph(const Options* options, int argc, char* argv[]); + int ToolQuery(const Options* options, int argc, char* argv[]); + int ToolDeps(const Options* options, int argc, char* argv[]); + int ToolBrowse(const Options* options, int argc, char* argv[]); + int ToolMSVC(const Options* options, int argc, char* argv[]); + int ToolTargets(const Options* options, int argc, char* argv[]); + int ToolCommands(const Options* options, int argc, char* argv[]); + int ToolClean(const Options* options, int argc, char* argv[]); + int ToolCompilationDatabase(const Options* options, int argc, char* argv[]); + int ToolRecompact(const Options* options, int argc, char* argv[]); + int ToolUrtle(const Options* options, int argc, char** argv); /// Open the build log. /// @return false on error. @@ -314,7 +314,7 @@ bool NinjaMain::CollectTargetsFromArgs(int argc, char* argv[], return true; } -int NinjaMain::ToolGraph(int argc, char* argv[]) { +int NinjaMain::ToolGraph(const Options* options, int argc, char* argv[]) { vector<Node*> nodes; string err; if (!CollectTargetsFromArgs(argc, argv, &nodes, &err)) { @@ -331,7 +331,7 @@ int NinjaMain::ToolGraph(int argc, char* argv[]) { return 0; } -int NinjaMain::ToolQuery(int argc, char* argv[]) { +int NinjaMain::ToolQuery(const Options* options, int argc, char* argv[]) { if (argc == 0) { Error("expected a target to query"); return 1; @@ -370,15 +370,15 @@ int NinjaMain::ToolQuery(int argc, char* argv[]) { } #if defined(NINJA_HAVE_BROWSE) -int NinjaMain::ToolBrowse(int argc, char* argv[]) { - RunBrowsePython(&state_, ninja_command_, argc, argv); +int NinjaMain::ToolBrowse(const Options* options, int argc, char* argv[]) { + RunBrowsePython(&state_, ninja_command_, options->input_file, argc, argv); // If we get here, the browse failed. return 1; } #endif // _WIN32 #if defined(_MSC_VER) -int NinjaMain::ToolMSVC(int argc, char* argv[]) { +int NinjaMain::ToolMSVC(const Options* options, int argc, char* argv[]) { // Reset getopt: push one argument onto the front of argv, reset optind. argc++; argv--; @@ -453,7 +453,7 @@ int ToolTargetsList(State* state) { return 0; } -int NinjaMain::ToolDeps(int argc, char** argv) { +int NinjaMain::ToolDeps(const Options* options, int argc, char** argv) { vector<Node*> nodes; if (argc == 0) { for (vector<Node*>::const_iterator ni = deps_log_.nodes().begin(); @@ -493,7 +493,7 @@ int NinjaMain::ToolDeps(int argc, char** argv) { return 0; } -int NinjaMain::ToolTargets(int argc, char* argv[]) { +int NinjaMain::ToolTargets(const Options* options, int argc, char* argv[]) { int depth = 1; if (argc >= 1) { string mode = argv[0]; @@ -547,7 +547,7 @@ void PrintCommands(Edge* edge, set<Edge*>* seen) { puts(edge->EvaluateCommand().c_str()); } -int NinjaMain::ToolCommands(int argc, char* argv[]) { +int NinjaMain::ToolCommands(const Options* options, int argc, char* argv[]) { vector<Node*> nodes; string err; if (!CollectTargetsFromArgs(argc, argv, &nodes, &err)) { @@ -562,7 +562,7 @@ int NinjaMain::ToolCommands(int argc, char* argv[]) { return 0; } -int NinjaMain::ToolClean(int argc, char* argv[]) { +int NinjaMain::ToolClean(const Options* options, int argc, char* argv[]) { // The clean tool uses getopt, and expects argv[0] to contain the name of // the tool, i.e. "clean". argc++; @@ -620,7 +620,7 @@ void EncodeJSONString(const char *str) { } } -int NinjaMain::ToolCompilationDatabase(int argc, char* argv[]) { +int NinjaMain::ToolCompilationDatabase(const Options* options, int argc, char* argv[]) { bool first = true; vector<char> cwd; @@ -660,7 +660,7 @@ int NinjaMain::ToolCompilationDatabase(int argc, char* argv[]) { return 0; } -int NinjaMain::ToolRecompact(int argc, char* argv[]) { +int NinjaMain::ToolRecompact(const Options* options, int argc, char* argv[]) { if (!EnsureBuildDirExists()) return 1; @@ -671,7 +671,7 @@ int NinjaMain::ToolRecompact(int argc, char* argv[]) { return 0; } -int NinjaMain::ToolUrtle(int argc, char** argv) { +int NinjaMain::ToolUrtle(const Options* options, int argc, char** argv) { // RLE encoded. const char* urtle = " 13 ,3;2!2;\n8 ,;<11!;\n5 `'<10!(2`'2!\n11 ,6;, `\\. `\\9 .,c13$ec,.\n6 " @@ -1097,7 +1097,7 @@ int real_main(int argc, char** argv) { // 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); + return (ninja.*options.tool->func)(&options, argc, argv); } // Limit number of rebuilds, to prevent infinite loops. @@ -1116,7 +1116,7 @@ int real_main(int argc, char** argv) { } if (options.tool && options.tool->when == Tool::RUN_AFTER_LOAD) - return (ninja.*options.tool->func)(argc, argv); + return (ninja.*options.tool->func)(&options, argc, argv); if (!ninja.EnsureBuildDirExists()) return 1; @@ -1125,7 +1125,7 @@ int real_main(int argc, char** argv) { return 1; if (options.tool && options.tool->when == Tool::RUN_AFTER_LOGS) - return (ninja.*options.tool->func)(argc, argv); + return (ninja.*options.tool->func)(&options, argc, argv); // Attempt to rebuild the manifest before building anything else if (ninja.RebuildManifest(options.input_file, &err)) { |