Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: tools/gn/command_desc.cc

Issue 26537002: Add a UniqueVector class to GN (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: clang npos Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "tools/gn/commands.h" 10 #include "tools/gn/commands.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 if (display_header) 209 if (display_header)
210 OutputString("\n" + heading + " (in order applying):\n"); 210 OutputString("\n" + heading + " (in order applying):\n");
211 211
212 Label toolchain_label = target->label().GetToolchainLabel(); 212 Label toolchain_label = target->label().GetToolchainLabel();
213 for (size_t i = 0; i < configs.size(); i++) { 213 for (size_t i = 0; i < configs.size(); i++) {
214 OutputString(" " + 214 OutputString(" " +
215 configs[i].label.GetUserVisibleName(toolchain_label) + "\n"); 215 configs[i].label.GetUserVisibleName(toolchain_label) + "\n");
216 } 216 }
217 } 217 }
218 218
219 void PrintConfigsVector(const Target* target,
220 const UniqueVector<LabelConfigPair>& configs,
221 const std::string& heading,
222 bool display_header) {
223 if (configs.empty())
224 return;
225
226 // Don't sort since the order determines how things are processed.
227 if (display_header)
228 OutputString("\n" + heading + " (in order applying):\n");
229
230 Label toolchain_label = target->label().GetToolchainLabel();
231 for (size_t i = 0; i < configs.size(); i++) {
232 OutputString(" " +
233 configs[i].label.GetUserVisibleName(toolchain_label) + "\n");
234 }
235 }
236
219 void PrintConfigs(const Target* target, bool display_header) { 237 void PrintConfigs(const Target* target, bool display_header) {
220 PrintConfigsVector(target, target->configs(), "configs", display_header); 238 PrintConfigsVector(target, target->configs().vector(), "configs",
239 display_header);
221 } 240 }
222 241
223 void PrintDirectDependentConfigs(const Target* target, bool display_header) { 242 void PrintDirectDependentConfigs(const Target* target, bool display_header) {
224 PrintConfigsVector(target, target->direct_dependent_configs(), 243 PrintConfigsVector(target, target->direct_dependent_configs(),
225 "direct_dependent_configs", display_header); 244 "direct_dependent_configs", display_header);
226 } 245 }
227 246
228 void PrintAllDependentConfigs(const Target* target, bool display_header) { 247 void PrintAllDependentConfigs(const Target* target, bool display_header) {
229 PrintConfigsVector(target, target->all_dependent_configs(), 248 PrintConfigsVector(target, target->all_dependent_configs(),
230 "all_dependent_configs", display_header); 249 "all_dependent_configs", display_header);
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 // so always display them, even for groups and such. 628 // so always display them, even for groups and such.
610 PrintLibs(target, true); 629 PrintLibs(target, true);
611 PrintLibDirs(target, true); 630 PrintLibDirs(target, true);
612 631
613 PrintDeps(target, true); 632 PrintDeps(target, true);
614 633
615 return 0; 634 return 0;
616 } 635 }
617 636
618 } // namespace commands 637 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/builder.cc ('k') | tools/gn/gn.gyp » ('j') | tools/gn/unique_vector.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698