Chromium Code Reviews| 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 <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 "tools/gn/commands.h" | 9 #include "tools/gn/commands.h" |
| 10 #include "tools/gn/deps_iterator.h" | 10 #include "tools/gn/deps_iterator.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 matches->push_back(target); | 197 matches->push_back(target); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace | 201 } // namespace |
| 202 | 202 |
| 203 const char kRefs[] = "refs"; | 203 const char kRefs[] = "refs"; |
| 204 const char kRefs_HelpShort[] = | 204 const char kRefs_HelpShort[] = |
| 205 "refs: Find stuff referencing a target or file."; | 205 "refs: Find stuff referencing a target or file."; |
| 206 const char kRefs_Help[] = | 206 const char kRefs_Help[] = |
| 207 "gn refs <build_dir> (<label_pattern>|<file>) [--files] [--tree] [--all]\n" | 207 "gn refs <out_dir> (<label_pattern>|<file>) [--files] [--tree] [--all]\n" |
| 208 " [--all-toolchains]\n" | 208 " [--all-toolchains]\n" |
| 209 "\n" | 209 "\n" |
| 210 " Finds reverse dependencies (which targets reference something). The\n" | 210 " Finds reverse dependencies (which targets reference something). The\n" |
| 211 " input is either a target label, a target label pattern, or a file\n" | 211 " input is either a target label, a target label pattern, or a file\n" |
| 212 " name.\n" | 212 " name.\n" |
| 213 "\n" | 213 "\n" |
| 214 " The <label_pattern> can take exact labels or patterns that match more\n" | 214 " The <label_pattern> can take exact labels or patterns that match more\n" |
| 215 " than one (although not general regular expressions).\n" | 215 " than one (although not general regular expressions).\n" |
| 216 " See \"gn help label_pattern\" for details.\n" | 216 " See \"gn help label_pattern\" for details.\n" |
| 217 "\n" | 217 "\n" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 " Display a reverse dependency tree to get to the given file. This\n" | 275 " Display a reverse dependency tree to get to the given file. This\n" |
| 276 " will show how dependencies will reference that file.\n" | 276 " will show how dependencies will reference that file.\n" |
| 277 "\n" | 277 "\n" |
| 278 " gn refs out/Debug //base/macros.h --all\n" | 278 " gn refs out/Debug //base/macros.h --all\n" |
| 279 " Display all unique targets with some dependency path to a target\n" | 279 " Display all unique targets with some dependency path to a target\n" |
| 280 " containing the given file as a source.\n"; | 280 " containing the given file as a source.\n"; |
| 281 | 281 |
| 282 int RunRefs(const std::vector<std::string>& args) { | 282 int RunRefs(const std::vector<std::string>& args) { |
| 283 if (args.size() != 2) { | 283 if (args.size() != 2) { |
| 284 Err(Location(), "You're holding it wrong.", | 284 Err(Location(), "You're holding it wrong.", |
| 285 "Usage: \"gn refs <build_dir> (<label_pattern>|<file>)\"") | 285 "Usage: \"gn refs <build_dir> (<label_pattern>|<file>)\"") |
|
scottmg
2015/02/02 02:18:43
another one here
tfarina
2015/02/03 02:10:58
Done.
| |
| 286 .PrintToStdout(); | 286 .PrintToStdout(); |
| 287 return 1; | 287 return 1; |
| 288 } | 288 } |
| 289 | 289 |
| 290 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 290 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 291 bool tree = cmdline->HasSwitch("tree"); | 291 bool tree = cmdline->HasSwitch("tree"); |
| 292 bool all = cmdline->HasSwitch("all"); | 292 bool all = cmdline->HasSwitch("all"); |
| 293 bool all_toolchains = cmdline->HasSwitch("all-toolchains"); | 293 bool all_toolchains = cmdline->HasSwitch("all-toolchains"); |
| 294 bool files = cmdline->HasSwitch("files"); | 294 bool files = cmdline->HasSwitch("files"); |
| 295 | 295 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 results.insert(cur_dep->second); | 378 results.insert(cur_dep->second); |
| 379 } | 379 } |
| 380 } | 380 } |
| 381 OutputResultSet(results, files); | 381 OutputResultSet(results, files); |
| 382 } | 382 } |
| 383 | 383 |
| 384 return 0; | 384 return 0; |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace commands | 387 } // namespace commands |
| OLD | NEW |