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 50638fbb7876819438dea2b6dbe659779da72731..39a27d3a997a65aa7153892e35df0496a6678a6b 100644 |
| --- a/tools/gn/ninja_build_writer.cc |
| +++ b/tools/gn/ninja_build_writer.cc |
| @@ -194,13 +194,17 @@ void NinjaBuildWriter::WriteNinjaRules() { |
| dep_out_ << "build.ninja:"; |
| std::vector<base::FilePath> input_files; |
| g_scheduler->input_file_manager()->GetAllPhysicalInputFileNames(&input_files); |
| - for (const auto& input_file : input_files) |
| - dep_out_ << " " << FilePathToUTF8(input_file); |
| + |
| + // Keep the files sorted to ensure output is deterministic. |
|
mithro-old
2015/12/03 05:20:31
If you are assuming the input is sorted here, it p
Zachary Forman
2015/12/03 07:27:02
Poorly phrased - we place the filepaths into a set
|
| + std::set<base::FilePath> file_set(input_files.begin(), input_files.end()); |
| // Other files read by the build. |
| - std::vector<base::FilePath> other_files = g_scheduler->GetGenDependencies(); |
| - for (const auto& other_file : other_files) |
| - dep_out_ << " " << FilePathToUTF8(other_file); |
| + input_files = g_scheduler->GetGenDependencies(); |
| + |
| + file_set.insert(input_files.begin(), input_files.end()); |
| + |
| + for (const auto& input_file : file_set) |
| + dep_out_ << " " << FilePathToUTF8(input_file); |
| out_ << std::endl; |
| } |