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

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

Issue 2481423002: Convert gn docstrings to C++11 raw strings. (Closed)
Patch Set: Fixes Created 4 years, 1 month 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 | « tools/gn/command_path.cc ('k') | tools/gn/docs/reference.md » ('j') | 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 FilterAndPrintTargetSet(false, results); 278 FilterAndPrintTargetSet(false, results);
279 return results.size(); 279 return results.size();
280 } 280 }
281 281
282 } // namespace 282 } // namespace
283 283
284 const char kRefs[] = "refs"; 284 const char kRefs[] = "refs";
285 const char kRefs_HelpShort[] = 285 const char kRefs_HelpShort[] =
286 "refs: Find stuff referencing a target or file."; 286 "refs: Find stuff referencing a target or file.";
287 const char kRefs_Help[] = 287 const char kRefs_Help[] =
288 "gn refs <out_dir> (<label_pattern>|<label>|<file>|@<response_file>)* " 288 R"(gn refs <out_dir> (<label_pattern>|<label>|<file>|@<response_file>)*
289 "[--all]\n" 289 [--all] [--all-toolchains] [--as=...] [--testonly=...] [--type=...]
290 " [--all-toolchains] [--as=...] [--testonly=...] [--type=...]\n" 290
291 "\n" 291 Finds reverse dependencies (which targets reference something). The input is
292 " Finds reverse dependencies (which targets reference something). The\n" 292 a list containing:
293 " input is a list containing:\n" 293
294 "\n" 294 - Target label: The result will be which targets depend on it.
295 " - Target label: The result will be which targets depend on it.\n" 295
296 "\n" 296 - Config label: The result will be which targets list the given config in
297 " - Config label: The result will be which targets list the given\n" 297 its "configs" or "public_configs" list.
298 " config in its \"configs\" or \"public_configs\" list.\n" 298
299 "\n" 299 - Label pattern: The result will be which targets depend on any target
300 " - Label pattern: The result will be which targets depend on any\n" 300 matching the given pattern. Patterns will not match configs. These are not
301 " target matching the given pattern. Patterns will not match\n" 301 general regular expressions, see "gn help label_pattern" for details.
302 " configs. These are not general regular expressions, see\n" 302
303 " \"gn help label_pattern\" for details.\n" 303 - File name: The result will be which targets list the given file in its
304 "\n" 304 "inputs", "sources", "public", "data", or "outputs". Any input that does
305 " - File name: The result will be which targets list the given file in\n" 305 not contain wildcards and does not match a target or a config will be
306 " its \"inputs\", \"sources\", \"public\", \"data\", or \"outputs\".\n" 306 treated as a file.
307 " Any input that does not contain wildcards and does not match a\n" 307
308 " target or a config will be treated as a file.\n" 308 - Response file: If the input starts with an "@", it will be interpreted as
309 "\n" 309 a path to a file containing a list of labels or file names, one per line.
310 " - Response file: If the input starts with an \"@\", it will be\n" 310 This allows us to handle long lists of inputs without worrying about
311 " interpreted as a path to a file containing a list of labels or\n" 311 command line limits.
312 " file names, one per line. This allows us to handle long lists\n" 312
313 " of inputs without worrying about command line limits.\n" 313 Options
314 "\n" 314
315 "Options\n" 315 --all
316 "\n" 316 When used without --tree, will recurse and display all unique
317 " --all\n" 317 dependencies of the given targets. For example, if the input is a target,
318 " When used without --tree, will recurse and display all unique\n" 318 this will output all targets that depend directly or indirectly on the
319 " dependencies of the given targets. For example, if the input is\n" 319 input. If the input is a file, this will output all targets that depend
320 " a target, this will output all targets that depend directly or\n" 320 directly or indirectly on that file.
321 " indirectly on the input. If the input is a file, this will output\n" 321
322 " all targets that depend directly or indirectly on that file.\n" 322 When used with --tree, turns off eliding to show a complete tree.
323 "\n" 323 )"
324 " When used with --tree, turns off eliding to show a complete tree.\n" 324
325 "\n" 325 ALL_TOOLCHAINS_SWITCH_HELP
326 ALL_TOOLCHAINS_SWITCH_HELP 326 "\n"
327 "\n" 327 TARGET_PRINTING_MODE_COMMAND_LINE_HELP
328 TARGET_PRINTING_MODE_COMMAND_LINE_HELP 328
329 "\n" 329 R"(
330 " -q\n" 330 -q
331 " Quiet. If nothing matches, don't print any output. Without this\n" 331 Quiet. If nothing matches, don't print any output. Without this option, if
332 " option, if there are no matches there will be an informational\n" 332 there are no matches there will be an informational message printed which
333 " message printed which might interfere with scripts processing the\n" 333 might interfere with scripts processing the output.
334 " output.\n" 334 )"
335 "\n" 335
336 TARGET_TESTONLY_FILTER_COMMAND_LINE_HELP 336 TARGET_TESTONLY_FILTER_COMMAND_LINE_HELP
337 "\n" 337
338 " --tree\n" 338 R"(
339 " Outputs a reverse dependency tree from the given target.\n" 339 --tree
340 " Duplicates will be elided. Combine with --all to see a full\n" 340 Outputs a reverse dependency tree from the given target. Duplicates will
341 " dependency tree.\n" 341 be elided. Combine with --all to see a full dependency tree.
342 "\n" 342
343 " Tree output can not be used with the filtering or output flags:\n" 343 Tree output can not be used with the filtering or output flags: --as,
344 " --as, --type, --testonly.\n" 344 --type, --testonly.
345 "\n" 345 )"
346 TARGET_TYPE_FILTER_COMMAND_LINE_HELP 346
347 "\n" 347 TARGET_TYPE_FILTER_COMMAND_LINE_HELP
348 "Examples (target input)\n" 348
349 "\n" 349 R"(
350 " gn refs out/Debug //tools/gn:gn\n" 350
351 " Find all targets depending on the given exact target name.\n" 351 Examples (target input)
352 "\n" 352
353 " gn refs out/Debug //base:i18n --as=buildfiles | xargs gvim\n" 353 gn refs out/Debug //tools/gn:gn
354 " Edit all .gn files containing references to //base:i18n\n" 354 Find all targets depending on the given exact target name.
355 "\n" 355
356 " gn refs out/Debug //base --all\n" 356 gn refs out/Debug //base:i18n --as=buildfiles | xargs gvim
357 " List all targets depending directly or indirectly on //base:base.\n" 357 Edit all .gn files containing references to //base:i18n
358 "\n" 358
359 " gn refs out/Debug \"//base/*\"\n" 359 gn refs out/Debug //base --all
360 " List all targets depending directly on any target in //base or\n" 360 List all targets depending directly or indirectly on //base:base.
361 " its subdirectories.\n" 361
362 "\n" 362 gn refs out/Debug "//base/*"
363 " gn refs out/Debug \"//base:*\"\n" 363 List all targets depending directly on any target in //base or
364 " List all targets depending directly on any target in\n" 364 its subdirectories.
365 " //base/BUILD.gn.\n" 365
366 "\n" 366 gn refs out/Debug "//base:*"
367 " gn refs out/Debug //base --tree\n" 367 List all targets depending directly on any target in
368 " Print a reverse dependency tree of //base:base\n" 368 //base/BUILD.gn.
369 "\n" 369
370 "Examples (file input)\n" 370 gn refs out/Debug //base --tree
371 "\n" 371 Print a reverse dependency tree of //base:base
372 " gn refs out/Debug //base/macros.h\n" 372
373 " Print target(s) listing //base/macros.h as a source.\n" 373 Examples (file input)
374 "\n" 374
375 " gn refs out/Debug //base/macros.h --tree\n" 375 gn refs out/Debug //base/macros.h
376 " Display a reverse dependency tree to get to the given file. This\n" 376 Print target(s) listing //base/macros.h as a source.
377 " will show how dependencies will reference that file.\n" 377
378 "\n" 378 gn refs out/Debug //base/macros.h --tree
379 " gn refs out/Debug //base/macros.h //base/at_exit.h --all\n" 379 Display a reverse dependency tree to get to the given file. This
380 " Display all unique targets with some dependency path to a target\n" 380 will show how dependencies will reference that file.
381 " containing either of the given files as a source.\n" 381
382 "\n" 382 gn refs out/Debug //base/macros.h //base/at_exit.h --all
383 " gn refs out/Debug //base/macros.h --testonly=true --type=executable\n" 383 Display all unique targets with some dependency path to a target
384 " --all --as=output\n" 384 containing either of the given files as a source.
385 " Display the executable file names of all test executables\n" 385
386 " potentially affected by a change to the given file.\n"; 386 gn refs out/Debug //base/macros.h --testonly=true --type=executable
387 --all --as=output
388 Display the executable file names of all test executables
389 potentially affected by a change to the given file.
390 )";
387 391
388 int RunRefs(const std::vector<std::string>& args) { 392 int RunRefs(const std::vector<std::string>& args) {
389 if (args.size() <= 1) { 393 if (args.size() <= 1) {
390 Err(Location(), "You're holding it wrong.", 394 Err(Location(), "You're holding it wrong.",
391 "Usage: \"gn refs <out_dir> (<label_pattern>|<file>)*\"") 395 "Usage: \"gn refs <out_dir> (<label_pattern>|<file>)*\"")
392 .PrintToStdout(); 396 .PrintToStdout();
393 return 1; 397 return 1;
394 } 398 }
395 399
396 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); 400 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 485
482 // If you ask for the references of a valid target, but that target has 486 // If you ask for the references of a valid target, but that target has
483 // nothing referencing it, we'll get here without having printed anything. 487 // nothing referencing it, we'll get here without having printed anything.
484 if (!quiet && cnt == 0) 488 if (!quiet && cnt == 0)
485 OutputString("Nothing references this.\n", DECORATION_YELLOW); 489 OutputString("Nothing references this.\n", DECORATION_YELLOW);
486 490
487 return 0; 491 return 0;
488 } 492 }
489 493
490 } // namespace commands 494 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/command_path.cc ('k') | tools/gn/docs/reference.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698