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_writer.h" | 5 #include "tools/gn/ninja_writer.h" |
6 | 6 |
7 #include "tools/gn/builder.h" | 7 #include "tools/gn/builder.h" |
8 #include "tools/gn/loader.h" | 8 #include "tools/gn/loader.h" |
9 #include "tools/gn/location.h" | 9 #include "tools/gn/location.h" |
10 #include "tools/gn/ninja_build_writer.h" | 10 #include "tools/gn/ninja_build_writer.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 bool NinjaWriter::WriteToolchains(std::vector<const Settings*>* all_settings, | 52 bool NinjaWriter::WriteToolchains(std::vector<const Settings*>* all_settings, |
53 std::vector<const Target*>* default_targets, | 53 std::vector<const Target*>* default_targets, |
54 std::vector<const Pool*>* all_pools, | 54 std::vector<const Pool*>* all_pools, |
55 Err* err) { | 55 Err* err) { |
56 // Categorize all targets by toolchain. | 56 // Categorize all targets by toolchain. |
57 typedef std::map<Label, std::vector<const Target*> > CategorizedMap; | 57 typedef std::map<Label, std::vector<const Target*> > CategorizedMap; |
58 CategorizedMap categorized; | 58 CategorizedMap categorized; |
59 | 59 |
60 std::vector<const BuilderRecord*> all_records = builder_->GetAllRecords(); | 60 std::vector<const BuilderRecord*> all_records = builder_->GetAllRecords(); |
61 for (const auto& all_record : all_records) { | 61 for (auto* all_record : all_records) { |
62 if (all_record->type() == BuilderRecord::ITEM_TARGET && | 62 if (all_record->type() == BuilderRecord::ITEM_TARGET && |
63 all_record->should_generate()) { | 63 all_record->should_generate()) { |
64 categorized[all_record->label().GetToolchainLabel()].push_back( | 64 categorized[all_record->label().GetToolchainLabel()].push_back( |
65 all_record->item()->AsTarget()); | 65 all_record->item()->AsTarget()); |
66 } | 66 } |
67 } | 67 } |
68 if (categorized.empty()) { | 68 if (categorized.empty()) { |
69 Err(Location(), "No targets.", | 69 Err(Location(), "No targets.", |
70 "I could not find any targets to write, so I'm doing nothing.") | 70 "I could not find any targets to write, so I'm doing nothing.") |
71 .PrintToStdout(); | 71 .PrintToStdout(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // should always be at least one settings object in the build. | 120 // should always be at least one settings object in the build. |
121 CHECK(!all_settings.empty()); | 121 CHECK(!all_settings.empty()); |
122 const Toolchain* default_toolchain = | 122 const Toolchain* default_toolchain = |
123 builder_->GetToolchain(all_settings[0]->default_toolchain_label()); | 123 builder_->GetToolchain(all_settings[0]->default_toolchain_label()); |
124 | 124 |
125 // Write the root buildfile. | 125 // Write the root buildfile. |
126 return NinjaBuildWriter::RunAndWriteFile(build_settings_, all_settings, | 126 return NinjaBuildWriter::RunAndWriteFile(build_settings_, all_settings, |
127 default_toolchain, default_targets, | 127 default_toolchain, default_targets, |
128 all_pools, err); | 128 all_pools, err); |
129 } | 129 } |
OLD | NEW |