| 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/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "tools/gn/build_settings.h" | 10 #include "tools/gn/build_settings.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // the writing to maintain a counter. | 51 // the writing to maintain a counter. |
| 52 base::subtle::Atomic32 write_counter = 0; | 52 base::subtle::Atomic32 write_counter = 0; |
| 53 setup->build_settings().set_target_resolved_callback( | 53 setup->build_settings().set_target_resolved_callback( |
| 54 base::Bind(&TargetResolvedCallback, &write_counter)); | 54 base::Bind(&TargetResolvedCallback, &write_counter)); |
| 55 | 55 |
| 56 // Do the actual load. This will also write out the target ninja files. | 56 // Do the actual load. This will also write out the target ninja files. |
| 57 if (!setup->Run()) | 57 if (!setup->Run()) |
| 58 return 1; | 58 return 1; |
| 59 | 59 |
| 60 // Write the root ninja files. | 60 // Write the root ninja files. |
| 61 if (!NinjaWriter::RunAndWriteFiles(&setup->build_settings())) { | 61 if (!NinjaWriter::RunAndWriteFiles(&setup->build_settings())) |
| 62 Err(Location(), | |
| 63 "Couldn't open root buildfile(s) for writing").PrintToStdout(); | |
| 64 return 1; | 62 return 1; |
| 65 } | |
| 66 | 63 |
| 67 base::TimeTicks end_time = base::TimeTicks::Now(); | 64 base::TimeTicks end_time = base::TimeTicks::Now(); |
| 68 | 65 |
| 69 if (!CommandLine::ForCurrentProcess()->HasSwitch(kSwitchQuiet)) { | 66 if (!CommandLine::ForCurrentProcess()->HasSwitch(kSwitchQuiet)) { |
| 70 OutputString("Done. ", DECORATION_GREEN); | 67 OutputString("Done. ", DECORATION_GREEN); |
| 71 | 68 |
| 72 std::string stats = "Wrote " + | 69 std::string stats = "Wrote " + |
| 73 base::IntToString(static_cast<int>(write_counter)) + | 70 base::IntToString(static_cast<int>(write_counter)) + |
| 74 " targets from " + | 71 " targets from " + |
| 75 base::IntToString( | 72 base::IntToString( |
| 76 setup->scheduler().input_file_manager()->GetInputFileCount()) + | 73 setup->scheduler().input_file_manager()->GetInputFileCount()) + |
| 77 " files in " + | 74 " files in " + |
| 78 base::IntToString((end_time - begin_time).InMilliseconds()) + "ms\n"; | 75 base::IntToString((end_time - begin_time).InMilliseconds()) + "ms\n"; |
| 79 OutputString(stats); | 76 OutputString(stats); |
| 80 } | 77 } |
| 81 | 78 |
| 82 return 0; | 79 return 0; |
| 83 } | 80 } |
| 84 | 81 |
| 85 } // namespace commands | 82 } // namespace commands |
| OLD | NEW |