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

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

Issue 2160383002: Make `gn refs` handle files in data directories properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn_refs_scripts
Patch Set: use base::StartsWith Created 4 years, 5 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 | « no previous file | no next file » | 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"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h"
13 #include "tools/gn/commands.h" 14 #include "tools/gn/commands.h"
14 #include "tools/gn/deps_iterator.h" 15 #include "tools/gn/deps_iterator.h"
15 #include "tools/gn/filesystem_utils.h" 16 #include "tools/gn/filesystem_utils.h"
16 #include "tools/gn/input_file.h" 17 #include "tools/gn/input_file.h"
17 #include "tools/gn/item.h" 18 #include "tools/gn/item.h"
18 #include "tools/gn/setup.h" 19 #include "tools/gn/setup.h"
19 #include "tools/gn/standard_out.h" 20 #include "tools/gn/standard_out.h"
20 #include "tools/gn/switches.h" 21 #include "tools/gn/switches.h"
21 #include "tools/gn/target.h" 22 #include "tools/gn/target.h"
22 23
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (cur_file == file) 137 if (cur_file == file)
137 return true; 138 return true;
138 } 139 }
139 for (const auto& cur_file : target->inputs()) { 140 for (const auto& cur_file : target->inputs()) {
140 if (cur_file == file) 141 if (cur_file == file)
141 return true; 142 return true;
142 } 143 }
143 for (const auto& cur_file : target->data()) { 144 for (const auto& cur_file : target->data()) {
144 if (cur_file == file.value()) 145 if (cur_file == file.value())
145 return true; 146 return true;
147 if (cur_file.back() == '/' &&
148 base::StartsWith(file.value(), cur_file, base::CompareCase::SENSITIVE))
149 return true;
146 } 150 }
147 151
148 if (target->action_values().script().value() == file.value()) 152 if (target->action_values().script().value() == file.value())
149 return true; 153 return true;
150 154
151 std::vector<SourceFile> outputs; 155 std::vector<SourceFile> outputs;
152 target->action_values().GetOutputsAsSourceFiles(target, &outputs); 156 target->action_values().GetOutputsAsSourceFiles(target, &outputs);
153 for (const auto& cur_file : outputs) { 157 for (const auto& cur_file : outputs) {
154 if (cur_file == file) 158 if (cur_file == file)
155 return true; 159 return true;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 481
478 // 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
479 // nothing referencing it, we'll get here without having printed anything. 483 // nothing referencing it, we'll get here without having printed anything.
480 if (!quiet && cnt == 0) 484 if (!quiet && cnt == 0)
481 OutputString("Nothing references this.\n", DECORATION_YELLOW); 485 OutputString("Nothing references this.\n", DECORATION_YELLOW);
482 486
483 return 0; 487 return 0;
484 } 488 }
485 489
486 } // namespace commands 490 } // namespace commands
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698