OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |