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

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: 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"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (cur_file == file) 136 if (cur_file == file)
137 return true; 137 return true;
138 } 138 }
139 for (const auto& cur_file : target->inputs()) { 139 for (const auto& cur_file : target->inputs()) {
140 if (cur_file == file) 140 if (cur_file == file)
141 return true; 141 return true;
142 } 142 }
143 for (const auto& cur_file : target->data()) { 143 for (const auto& cur_file : target->data()) {
144 if (cur_file == file.value()) 144 if (cur_file == file.value())
145 return true; 145 return true;
146 if (cur_file.back() == '/' &&
147 !strncmp(cur_file.c_str(), file.value().c_str(), cur_file.size() - 1))
brettw 2016/07/20 17:52:14 How about cur_file.back() == '/' && !base::StartsW
Dirk Pranke 2016/07/20 21:24:31 I figured there was some base routine for this but
148 return true;
146 } 149 }
147 150
148 if (target->action_values().script().value() == file.value()) 151 if (target->action_values().script().value() == file.value())
149 return true; 152 return true;
150 153
151 std::vector<SourceFile> outputs; 154 std::vector<SourceFile> outputs;
152 target->action_values().GetOutputsAsSourceFiles(target, &outputs); 155 target->action_values().GetOutputsAsSourceFiles(target, &outputs);
153 for (const auto& cur_file : outputs) { 156 for (const auto& cur_file : outputs) {
154 if (cur_file == file) 157 if (cur_file == file)
155 return true; 158 return true;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 480
478 // If you ask for the references of a valid target, but that target has 481 // 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. 482 // nothing referencing it, we'll get here without having printed anything.
480 if (!quiet && cnt == 0) 483 if (!quiet && cnt == 0)
481 OutputString("Nothing references this.\n", DECORATION_YELLOW); 484 OutputString("Nothing references this.\n", DECORATION_YELLOW);
482 485
483 return 0; 486 return 0;
484 } 487 }
485 488
486 } // namespace commands 489 } // 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