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

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

Issue 1494883002: GN: Makes GN output deterministic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
11 #include "tools/gn/commands.h" 11 #include "tools/gn/commands.h"
12 #include "tools/gn/deps_iterator.h" 12 #include "tools/gn/deps_iterator.h"
13 #include "tools/gn/filesystem_utils.h" 13 #include "tools/gn/filesystem_utils.h"
14 #include "tools/gn/input_file.h" 14 #include "tools/gn/input_file.h"
15 #include "tools/gn/item.h" 15 #include "tools/gn/item.h"
16 #include "tools/gn/pointer_set.h"
16 #include "tools/gn/setup.h" 17 #include "tools/gn/setup.h"
17 #include "tools/gn/standard_out.h" 18 #include "tools/gn/standard_out.h"
18 #include "tools/gn/target.h" 19 #include "tools/gn/target.h"
19 20
20 namespace commands { 21 namespace commands {
21 22
22 namespace { 23 namespace {
23 24
24 typedef std::set<const Target*> TargetSet; 25 typedef PointerSet<const Target> TargetSet;
25 typedef std::vector<const Target*> TargetVector; 26 typedef std::vector<const Target*> TargetVector;
26 27
27 // Maps targets to the list of targets that depend on them. 28 // Maps targets to the list of targets that depend on them.
28 typedef std::multimap<const Target*, const Target*> DepMap; 29 typedef std::multimap<const Target*, const Target*> DepMap;
29 30
30 // Populates the reverse dependency map for the targets in the Setup. 31 // Populates the reverse dependency map for the targets in the Setup.
31 void FillDepMap(Setup* setup, DepMap* dep_map) { 32 void FillDepMap(Setup* setup, DepMap* dep_map) {
32 for (const auto& target : setup->builder()->GetAllResolvedTargets()) { 33 for (const auto& target : setup->builder()->GetAllResolvedTargets()) {
33 for (const auto& dep_pair : target->GetDeps(Target::DEPS_ALL)) 34 for (const auto& dep_pair : target->GetDeps(Target::DEPS_ALL))
34 dep_map->insert(std::make_pair(dep_pair.ptr, target)); 35 dep_map->insert(std::make_pair(dep_pair.ptr, target));
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 481
481 // 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
482 // nothing referencing it, we'll get here without having printed anything. 483 // nothing referencing it, we'll get here without having printed anything.
483 if (!quiet && cnt == 0) 484 if (!quiet && cnt == 0)
484 OutputString("Nothing references this.\n", DECORATION_YELLOW); 485 OutputString("Nothing references this.\n", DECORATION_YELLOW);
485 486
486 return 0; 487 return 0;
487 } 488 }
488 489
489 } // namespace commands 490 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/command_desc.cc ('k') | tools/gn/commands.h » ('j') | tools/gn/ninja_build_writer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698