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

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

Issue 2152413002: GN: don't write separate files for non-binary targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 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
« no previous file with comments | « tools/gn/command_ls.cc ('k') | tools/gn/commands.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 15 matching lines...) Expand all
26 namespace { 26 namespace {
27 27
28 typedef std::set<const Target*> TargetSet; 28 typedef std::set<const Target*> TargetSet;
29 typedef std::vector<const Target*> TargetVector; 29 typedef std::vector<const Target*> TargetVector;
30 30
31 // Maps targets to the list of targets that depend on them. 31 // Maps targets to the list of targets that depend on them.
32 typedef std::multimap<const Target*, const Target*> DepMap; 32 typedef std::multimap<const Target*, const Target*> DepMap;
33 33
34 // Populates the reverse dependency map for the targets in the Setup. 34 // Populates the reverse dependency map for the targets in the Setup.
35 void FillDepMap(Setup* setup, DepMap* dep_map) { 35 void FillDepMap(Setup* setup, DepMap* dep_map) {
36 for (auto* target : setup->builder()->GetAllResolvedTargets()) { 36 for (auto* target : setup->builder().GetAllResolvedTargets()) {
37 for (const auto& dep_pair : target->GetDeps(Target::DEPS_ALL)) 37 for (const auto& dep_pair : target->GetDeps(Target::DEPS_ALL))
38 dep_map->insert(std::make_pair(dep_pair.ptr, target)); 38 dep_map->insert(std::make_pair(dep_pair.ptr, target));
39 } 39 }
40 } 40 }
41 41
42 // Forward declaration for function below. 42 // Forward declaration for function below.
43 size_t RecursivePrintTargetDeps(const DepMap& dep_map, 43 size_t RecursivePrintTargetDeps(const DepMap& dep_map,
44 const Target* target, 44 const Target* target,
45 TargetSet* seen_targets, 45 TargetSet* seen_targets,
46 int indent_level); 46 int indent_level);
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 &target_matches, &config_matches, 436 &target_matches, &config_matches,
437 &toolchain_matches, &file_matches)) 437 &toolchain_matches, &file_matches))
438 return 1; 438 return 1;
439 439
440 // When you give a file or config as an input, you want the targets that are 440 // When you give a file or config as an input, you want the targets that are
441 // associated with it. We don't want to just append this to the 441 // associated with it. We don't want to just append this to the
442 // target_matches, however, since these targets should actually be listed in 442 // target_matches, however, since these targets should actually be listed in
443 // the output, while for normal targets you don't want to see the inputs, 443 // the output, while for normal targets you don't want to see the inputs,
444 // only what refers to them. 444 // only what refers to them.
445 std::vector<const Target*> all_targets = 445 std::vector<const Target*> all_targets =
446 setup->builder()->GetAllResolvedTargets(); 446 setup->builder().GetAllResolvedTargets();
447 UniqueVector<const Target*> explicit_target_matches; 447 UniqueVector<const Target*> explicit_target_matches;
448 for (const auto& file : file_matches) { 448 for (const auto& file : file_matches) {
449 GetTargetsContainingFile(setup, all_targets, file, all_toolchains, 449 GetTargetsContainingFile(setup, all_targets, file, all_toolchains,
450 &explicit_target_matches); 450 &explicit_target_matches);
451 } 451 }
452 for (auto* config : config_matches) { 452 for (auto* config : config_matches) {
453 GetTargetsReferencingConfig(setup, all_targets, config, all_toolchains, 453 GetTargetsReferencingConfig(setup, all_targets, config, all_toolchains,
454 &explicit_target_matches); 454 &explicit_target_matches);
455 } 455 }
456 456
(...skipping 24 matching lines...) Expand all
481 481
482 // If you ask for the references of a valid target, but that target has 482 // If you ask for the references of a valid target, but that target has
483 // nothing referencing it, we'll get here without having printed anything. 483 // nothing referencing it, we'll get here without having printed anything.
484 if (!quiet && cnt == 0) 484 if (!quiet && cnt == 0)
485 OutputString("Nothing references this.\n", DECORATION_YELLOW); 485 OutputString("Nothing references this.\n", DECORATION_YELLOW);
486 486
487 return 0; 487 return 0;
488 } 488 }
489 489
490 } // namespace commands 490 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/command_ls.cc ('k') | tools/gn/commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698