Index: tools/gn/ninja_build_writer.cc |
diff --git a/tools/gn/ninja_build_writer.cc b/tools/gn/ninja_build_writer.cc |
index 591947d38cae9ca29918c11fc7697625fd56a229..12a37e13d8b5eaa735339b37a8ebed52b47fb670 100644 |
--- a/tools/gn/ninja_build_writer.cc |
+++ b/tools/gn/ninja_build_writer.cc |
@@ -76,7 +76,6 @@ std::string GetSelfInvocationCommand(const BuildSettings* build_settings) { |
return cmdline.GetCommandLineString(); |
#endif |
} |
- |
} // namespace |
NinjaBuildWriter::NinjaBuildWriter( |
@@ -143,10 +142,23 @@ bool NinjaBuildWriter::RunAndWriteFile( |
void NinjaBuildWriter::WriteNinjaRules() { |
out_ << "rule gn\n"; |
out_ << " command = " << GetSelfInvocationCommand(build_settings_) << "\n"; |
- out_ << " description = Regenerating ninja files\n\n"; |
+ out_ << " description = Regenerating ninja files\n"; |
+ out_ << " restat = 1\n\n"; |
Peter Mayo
2015/09/23 18:53:34
This is important for this change.
|
+ |
+ // This rule will regenerate the ninja files when any input file has changed, |
+ // or is missing. |
+ out_ << "build build.ninja"; |
- // This rule will regenerate the ninja files when any input file has changed. |
- out_ << "build build.ninja: gn\n" |
+ // Other files read by the build. |
+ EscapeOptions path_escaping; |
+ path_escaping.mode = ESCAPE_NINJA_COMMAND; |
+ std::vector<SourceFile> written_files = g_scheduler->GetWrittenFiles(); |
+ for (const auto& written_file : written_files) |
+ out_ << " " << |
Peter Mayo
2015/07/30 23:25:32
Is this the right wrapping? dropping the << onto
Dirk Pranke
2015/07/30 23:37:08
no clue :).
brettw
2015/07/31 00:57:01
Seems "not wrong"
|
+ EscapeString(FilePathToUTF8(build_settings_->GetFullPath(written_file)), |
+ path_escaping, nullptr); |
+ |
+ out_ << ": gn\n" |
<< " generator = 1\n" |
<< " depfile = build.ninja.d\n"; |