Chromium Code Reviews| Index: tools/gn/ninja_toolchain_writer.cc |
| diff --git a/tools/gn/ninja_toolchain_writer.cc b/tools/gn/ninja_toolchain_writer.cc |
| index e7459ebb3cfa2ede1e0d5303aedfdf0b36e134b2..d3b65dbbcb90bcf3b36b194fdc6bc33d1315aa56 100644 |
| --- a/tools/gn/ninja_toolchain_writer.cc |
| +++ b/tools/gn/ninja_toolchain_writer.cc |
| @@ -49,7 +49,7 @@ void NinjaToolchainWriter::Run() { |
| bool NinjaToolchainWriter::RunAndWriteFile( |
| const Settings* settings, |
| const Toolchain* toolchain, |
| - const std::vector<const Target*>& targets) { |
| + std::vector<const Target*>& targets) { |
| base::FilePath ninja_file(settings->build_settings()->GetFullPath( |
| GetNinjaFileForToolchain(settings))); |
| ScopedTrace trace(TraceItem::TRACE_FILE_WRITE, FilePathToUTF8(ninja_file)); |
| @@ -62,6 +62,9 @@ bool NinjaToolchainWriter::RunAndWriteFile( |
| if (file.fail()) |
| return false; |
| + // Sort here to ensure the files are deterministically ordered. |
|
M-A Ruel
2015/12/07 00:20:16
You could DCHECK instead that the list is sorted.
Zachary Forman
2015/12/07 03:18:17
This is poor phrasing on my part - they come in un
|
| + std::sort(targets.begin(), targets.end(), DereferenceComparator<Target>()); |
| + |
| NinjaToolchainWriter gen(settings, toolchain, targets, file); |
| gen.Run(); |
| return true; |