Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace | 275 } // namespace |
| 276 | 276 |
| 277 const char kPath[] = "path"; | 277 const char kPath[] = "path"; |
| 278 const char kPath_HelpShort[] = | 278 const char kPath_HelpShort[] = |
| 279 "path: Find paths between two targets."; | 279 "path: Find paths between two targets."; |
| 280 const char kPath_Help[] = | 280 const char kPath_Help[] = |
| 281 "gn path <out_dir> <target_one> <target_two>\n" | 281 R"(gn path <out_dir> <target_one> <target_two> |
| 282 "\n" | 282 |
| 283 " Finds paths of dependencies between two targets. Each unique path\n" | 283 Finds paths of dependencies between two targets. Each unique path will be |
| 284 " will be printed in one group, and groups will be separate by newlines.\n" | 284 printed in one group, and groups will be separate by newlines. The two |
| 285 " The two targets can appear in either order (paths will be found going\n" | 285 targets can appear in either order (paths will be found going in either |
| 286 " in either direction).\n" | 286 direction). |
| 287 "\n" | 287 |
| 288 " By default, a single path will be printed. If there is a path with\n" | 288 By default, a single path will be printed. If there is a path with only |
| 289 " only public dependencies, the shortest public path will be printed.\n" | 289 public dependencies, the shortest public path will be printed. Otherwise, the |
| 290 " Otherwise, the shortest path using either public or private\n" | 290 shortest path using either public or private dependencies will be printed. If |
| 291 " dependencies will be printed. If --with-data is specified, data deps\n" | 291 --with-data is specified, data deps will also be considered. If there are |
| 292 " will also be considered. If there are multiple shortest paths, an\n" | 292 multiple shortest paths, an arbitrary one will be selected. |
| 293 " arbitrary one will be selected.\n" | 293 |
| 294 "\n" | 294 Interesting paths |
| 295 "Interesting paths\n" | 295 |
| 296 "\n" | 296 In a large project, there can be 100's of millions of unique paths between a |
| 297 " In a large project, there can be 100's of millions of unique paths\n" | 297 very high level and a common low-level target. To make the output more useful |
| 298 " between a very high level and a common low-level target. To make the\n" | 298 (and terminate in a reasonable time), GN will not revisit sub-paths |
| 299 " output more useful (and terminate in a reasonable time), GN will not\n" | 299 previously known to lead to the target. |
| 300 " revisit sub-paths previously known to lead to the target.\n" | 300 |
| 301 "\n" | 301 Options |
| 302 "Options\n" | 302 |
| 303 "\n" | 303 --all |
| 304 " --all\n" | 304 Prints all "interesting" paths found rather than just the first one. |
| 305 " Prints all \"interesting\" paths found rather than just the first\n" | 305 Public paths will be printed first in order of increasing length, followed |
| 306 " one. Public paths will be printed first in order of increasing\n" | 306 by non-public paths in order of increasing length. |
| 307 " length, followed by non-public paths in order of increasing length.\n" | 307 |
| 308 "\n" | 308 --public |
| 309 " --public\n" | 309 Considers only public paths. Can't be used with --with-data. |
| 310 " Considers only public paths. Can't be used with --with-data.\n" | 310 |
| 311 "\n" | 311 --with-data |
| 312 " --with-data\n" | 312 Additionally follows data deps. Without this flag, only public and private |
| 313 " Additionally follows data deps. Without this flag, only public and\n" | 313 linked deps will be followed. Can't be used with --public. |
| 314 " private linked deps will be followed. Can't be used with --public.\n" | 314 |
| 315 "\n" | 315 Example |
| 316 "Example\n" | 316 |
| 317 "\n" | 317 gn path out/Default //base //tools/gn)"; |
|
scottmg
2016/11/08 00:27:52
One more
| |
| 318 " gn path out/Default //base //tools/gn\n"; | |
| 319 | 318 |
| 320 int RunPath(const std::vector<std::string>& args) { | 319 int RunPath(const std::vector<std::string>& args) { |
| 321 if (args.size() != 3) { | 320 if (args.size() != 3) { |
| 322 Err(Location(), "You're holding it wrong.", | 321 Err(Location(), "You're holding it wrong.", |
| 323 "Usage: \"gn path <out_dir> <target_one> <target_two>\"") | 322 "Usage: \"gn path <out_dir> <target_one> <target_two>\"") |
| 324 .PrintToStdout(); | 323 .PrintToStdout(); |
| 325 return 1; | 324 return 1; |
| 326 } | 325 } |
| 327 | 326 |
| 328 Setup* setup = new Setup; | 327 Setup* setup = new Setup; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 OutputString(base::StringPrintf(" %d of them are public.\n", | 405 OutputString(base::StringPrintf(" %d of them are public.\n", |
| 407 stats.public_paths)); | 406 stats.public_paths)); |
| 408 } | 407 } |
| 409 OutputString("Use --all to print all paths.\n"); | 408 OutputString("Use --all to print all paths.\n"); |
| 410 } | 409 } |
| 411 } | 410 } |
| 412 return 0; | 411 return 0; |
| 413 } | 412 } |
| 414 | 413 |
| 415 } // namespace commands | 414 } // namespace commands |
| OLD | NEW |