| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/ninja_build_writer.h" | 5 #include "tools/gn/ninja_build_writer.h" |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 NinjaBuildWriter gen(build_settings, all_settings, | 116 NinjaBuildWriter gen(build_settings, all_settings, |
| 117 default_toolchain_targets, file, depfile); | 117 default_toolchain_targets, file, depfile); |
| 118 gen.Run(); | 118 gen.Run(); |
| 119 return true; | 119 return true; |
| 120 } | 120 } |
| 121 | 121 |
| 122 void NinjaBuildWriter::WriteNinjaRules() { | 122 void NinjaBuildWriter::WriteNinjaRules() { |
| 123 out_ << "rule gn\n"; | 123 out_ << "rule gn\n"; |
| 124 out_ << " command = " << GetSelfInvocationCommand(build_settings_) << "\n"; | 124 out_ << " command = " << GetSelfInvocationCommand(build_settings_) << "\n"; |
| 125 out_ << " description = GN the world\n\n"; | 125 out_ << " description = Regenerating ninja files\n\n"; |
| 126 | 126 |
| 127 out_ << "build build.ninja: gn\n" | 127 out_ << "build build.ninja: gn\n" |
| 128 << " depfile = build.ninja.d\n"; | 128 << " depfile = build.ninja.d\n"; |
| 129 | 129 |
| 130 // Input build files. These go in the ".d" file. If we write them as | 130 // Input build files. These go in the ".d" file. If we write them as |
| 131 // dependencies in the .ninja file itself, ninja will expect the files to | 131 // dependencies in the .ninja file itself, ninja will expect the files to |
| 132 // exist and will error if they don't. When files are listed in a depfile, | 132 // exist and will error if they don't. When files are listed in a depfile, |
| 133 // missing files are ignored. | 133 // missing files are ignored. |
| 134 dep_out_ << "build.ninja:"; | 134 dep_out_ << "build.ninja:"; |
| 135 std::vector<base::FilePath> input_files; | 135 std::vector<base::FilePath> input_files; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 all_rules.append(" $\n "); | 174 all_rules.append(" $\n "); |
| 175 all_rules.append(target_file.value()); | 175 all_rules.append(target_file.value()); |
| 176 } | 176 } |
| 177 | 177 |
| 178 if (!all_rules.empty()) { | 178 if (!all_rules.empty()) { |
| 179 out_ << "\nbuild all: phony " << all_rules << std::endl; | 179 out_ << "\nbuild all: phony " << all_rules << std::endl; |
| 180 out_ << "default all" << std::endl; | 180 out_ << "default all" << std::endl; |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| OLD | NEW |