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 "base/atomicops.h" | 5 #include "base/atomicops.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/timer/elapsed_timer.h" | 9 #include "base/timer/elapsed_timer.h" |
10 #include "tools/gn/build_settings.h" | 10 #include "tools/gn/build_settings.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // the writing to maintain a counter. | 87 // the writing to maintain a counter. |
88 base::subtle::Atomic32 write_counter = 0; | 88 base::subtle::Atomic32 write_counter = 0; |
89 setup->builder()->set_resolved_callback( | 89 setup->builder()->set_resolved_callback( |
90 base::Bind(&ItemResolvedCallback, &write_counter, | 90 base::Bind(&ItemResolvedCallback, &write_counter, |
91 scoped_refptr<Builder>(setup->builder()))); | 91 scoped_refptr<Builder>(setup->builder()))); |
92 | 92 |
93 // Do the actual load. This will also write out the target ninja files. | 93 // Do the actual load. This will also write out the target ninja files. |
94 if (!setup->Run()) | 94 if (!setup->Run()) |
95 return 1; | 95 return 1; |
96 | 96 |
| 97 Err err; |
97 // Write the root ninja files. | 98 // Write the root ninja files. |
98 if (!NinjaWriter::RunAndWriteFiles(&setup->build_settings(), | 99 if (!NinjaWriter::RunAndWriteFiles(&setup->build_settings(), |
99 setup->builder())) | 100 setup->builder(), |
| 101 &err)) { |
| 102 err.PrintToStdout(); |
100 return 1; | 103 return 1; |
| 104 } |
101 | 105 |
102 base::TimeDelta elapsed_time = timer.Elapsed(); | 106 base::TimeDelta elapsed_time = timer.Elapsed(); |
103 | 107 |
104 if (!CommandLine::ForCurrentProcess()->HasSwitch(kSwitchQuiet)) { | 108 if (!CommandLine::ForCurrentProcess()->HasSwitch(kSwitchQuiet)) { |
105 OutputString("Done. ", DECORATION_GREEN); | 109 OutputString("Done. ", DECORATION_GREEN); |
106 | 110 |
107 std::string stats = "Wrote " + | 111 std::string stats = "Wrote " + |
108 base::IntToString(static_cast<int>(write_counter)) + | 112 base::IntToString(static_cast<int>(write_counter)) + |
109 " targets from " + | 113 " targets from " + |
110 base::IntToString( | 114 base::IntToString( |
111 setup->scheduler().input_file_manager()->GetInputFileCount()) + | 115 setup->scheduler().input_file_manager()->GetInputFileCount()) + |
112 " files in " + | 116 " files in " + |
113 base::IntToString(elapsed_time.InMilliseconds()) + "ms\n"; | 117 base::IntToString(elapsed_time.InMilliseconds()) + "ms\n"; |
114 OutputString(stats); | 118 OutputString(stats); |
115 } | 119 } |
116 | 120 |
117 return 0; | 121 return 0; |
118 } | 122 } |
119 | 123 |
120 } // namespace commands | 124 } // namespace commands |
OLD | NEW |