Chromium Code Reviews| Index: tools/gn/ninja_build_writer.cc |
| diff --git a/tools/gn/ninja_build_writer.cc b/tools/gn/ninja_build_writer.cc |
| index b7cfdd797cdb620617fc8dd5a8ed9d393a7d44f0..b46df68b959cd5ce534e78ad0a1e96c638d3ffaf 100644 |
| --- a/tools/gn/ninja_build_writer.cc |
| +++ b/tools/gn/ninja_build_writer.cc |
| @@ -136,9 +136,26 @@ void NinjaBuildWriter::WriteNinjaRules() { |
| out_ << " command = " << GetSelfInvocationCommand(build_settings_) << "\n"; |
| out_ << " description = Regenerating ninja files\n\n"; |
| + // This rule will regenerate the ninja files when any input file has changed. |
| out_ << "build build.ninja: gn\n" |
| << " depfile = build.ninja.d\n"; |
| + // Provide a way to force regenerating ninja files if the user is suspicious |
| + // something is out-of-date. This will be "ninja refresh". |
| + out_ << "\nbuild refresh: gn\n"; |
|
scottmg
2013/11/22 20:53:21
This would break if there was a file named "refres
|
| + |
| + // Provide a way to see what flags are associated with this build: |
| + // This will be "ninja show" and will show up like: |
|
scottmg
2013/11/22 20:53:21
missing example in comment
|
| + const CommandLine& our_cmdline = *CommandLine::ForCurrentProcess(); |
| + std::string args = our_cmdline.GetSwitchValueASCII("args"); |
| + out_ << "rule echo\n"; |
| + out_ << " command = echo $text\n"; |
| + out_ << " description = ECHO $desc\n"; |
| + out_ << "build show: echo\n"; |
| + out_ << " desc = build arguments:\n"; |
| + out_ << " text = " << (args.empty() ? std::string("<default args>") : args) |
| + << "\n"; |
| + |
| // Input build files. These go in the ".d" file. If we write them as |
| // dependencies in the .ninja file itself, ninja will expect the files to |
| // exist and will error if they don't. When files are listed in a depfile, |