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

Unified Diff: tools/gn/functions.cc

Issue 500423003: Enhance GN diagnostic tools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use patterns for gn check Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/commands.cc ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/functions.cc
diff --git a/tools/gn/functions.cc b/tools/gn/functions.cc
index 35e42d44e98a739179ab0a4e474f4c2c64dd97f3..788b06fadc546e732dab735ffc1acf5d6425e612 100644
--- a/tools/gn/functions.cc
+++ b/tools/gn/functions.cc
@@ -489,8 +489,6 @@ const char kSetSourcesAssignmentFilter_Help[] =
" example, you may want to filter out all \"*_win.cc\" files on non-\n"
" Windows platforms.\n"
"\n"
- " See \"gn help patterns\" for specifics on patterns.\n"
- "\n"
" Typically this will be called once in the master build config script\n"
" to set up the filter for the current platform. Subsequent calls will\n"
" overwrite the previous values.\n"
@@ -499,9 +497,45 @@ const char kSetSourcesAssignmentFilter_Help[] =
" be filtered out, call set_sources_assignment_filter([]) to clear the\n"
" list of filters. This will apply until the current scope exits\n"
"\n"
- "Example:\n"
+ "How to use patterns\n"
+ "\n"
+ " File patterns are VERY limited regular expressions. They must match\n"
+ " the entire input string to be counted as a match. In regular\n"
+ " expression parlance, there is an implicit \"^...$\" surrounding your\n"
+ " input. If you want to match a substring, you need to use wildcards at\n"
+ " the beginning and end.\n"
+ "\n"
+ " There are only two special tokens understood by the pattern matcher.\n"
+ " Everything else is a literal.\n"
+ "\n"
+ " * Matches zero or more of any character. It does not depend on the\n"
+ " preceding character (in regular expression parlance it is\n"
+ " equivalent to \".*\").\n"
+ "\n"
+ " \\b Matches a path boundary. This will match the beginning or end of\n"
+ " a string, or a slash.\n"
+ "\n"
+ "Pattern examples\n"
+ "\n"
+ " \"*asdf*\"\n"
+ " Matches a string containing \"asdf\" anywhere.\n"
+ "\n"
+ " \"asdf\"\n"
+ " Matches only the exact string \"asdf\".\n"
+ "\n"
+ " \"*.cc\"\n"
+ " Matches strings ending in the literal \".cc\".\n"
+ "\n"
+ " \"\\bwin/*\"\n"
+ " Matches \"win/foo\" and \"foo/win/bar.cc\" but not \"iwin/foo\".\n"
+ "\n"
+ "Sources assignment example\n"
+ "\n"
" # Filter out all _win files.\n"
- " set_sources_assignment_filter([ \"*_win.cc\", \"*_win.h\" ])\n";
+ " set_sources_assignment_filter([ \"*_win.cc\", \"*_win.h\" ])\n"
+ " sources = [ \"a.cc\", \"b_win.cc\" ]\n"
+ " print(sources)\n"
+ " # Will print [ \"a.cc\" ]. b_win one was filtered out.\n";
Value RunSetSourcesAssignmentFilter(Scope* scope,
const FunctionCallNode* function,
« no previous file with comments | « tools/gn/commands.cc ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698