| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "tools/gn/switches.h" | 5 #include "tools/gn/switches.h" |
| 6 | 6 |
| 7 namespace switches { | 7 namespace switches { |
| 8 | 8 |
| 9 const char kArgs[] = "args"; | 9 const char kArgs[] = "args"; |
| 10 const char kArgs_HelpShort[] = | 10 const char kArgs_HelpShort[] = |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const char kDotfile_Help[] = | 62 const char kDotfile_Help[] = |
| 63 "--dotfile: Override the name of the \".gn\" file.\n" | 63 "--dotfile: Override the name of the \".gn\" file.\n" |
| 64 "\n" | 64 "\n" |
| 65 " Normally GN loads the \".gn\"file from the source root for some basic\n" | 65 " Normally GN loads the \".gn\"file from the source root for some basic\n" |
| 66 " configuration (see \"gn help dotfile\"). This flag allows you to\n" | 66 " configuration (see \"gn help dotfile\"). This flag allows you to\n" |
| 67 " use a different file.\n" | 67 " use a different file.\n" |
| 68 "\n" | 68 "\n" |
| 69 " Note that this interacts with \"--root\" in a possibly incorrect way.\n" | 69 " Note that this interacts with \"--root\" in a possibly incorrect way.\n" |
| 70 " It would be nice to test the edge cases and document or fix.\n"; | 70 " It would be nice to test the edge cases and document or fix.\n"; |
| 71 | 71 |
| 72 const char kFailOnUnusedArgs[] = "fail-on-unused-args"; |
| 73 const char kFailOnUnusedArgs_HelpShort[] = |
| 74 "--fail-on-unused-args: Treat unused build args as fatal errors."; |
| 75 const char kFailOnUnusedArgs_Help[] = |
| 76 "--fail-on-unused-args: Treat unused build args as fatal errors.\n" |
| 77 "\n" |
| 78 " If you set a value in a build's \"gn args\" and never use it in the\n" |
| 79 " build (in a declare_args() block), GN will normally print an error\n" |
| 80 " but not fail the build.\n" |
| 81 "\n" |
| 82 " In many cases engineers would use build args to enable or disable\n" |
| 83 " features that would sometimes get removed. It would by annoying to\n" |
| 84 " block work for typically benign problems. In Chrome in particular,\n" |
| 85 " flags might be configured for build bots in a separate infrastructure\n" |
| 86 " repository, or a declare_args block might be changed in a third party\n" |
| 87 " repository. Treating these errors as blocking forced complex multi-\n" |
| 88 " way patches to land what would otherwise be simple changes.\n" |
| 89 "\n" |
| 90 " In some cases, such concerns are not as important, and a mismatch\n" |
| 91 " in build flags between the invoker of the build and the build files\n" |
| 92 " represents a critical mismatch that should be immediately fixed. Such\n" |
| 93 " users can set this flag to force GN to fail in that case.\n"; |
| 94 |
| 72 const char kMarkdown[] = "markdown"; | 95 const char kMarkdown[] = "markdown"; |
| 73 const char kMarkdown_HelpShort[] = | 96 const char kMarkdown_HelpShort[] = |
| 74 "--markdown: write the output in the Markdown format."; | 97 "--markdown: Write help output in the Markdown format."; |
| 75 const char kMarkdown_Help[] = | 98 const char kMarkdown_Help[] = |
| 76 "--markdown: write the output in the Markdown format.\n"; | 99 "--markdown: Write help output in the Markdown format.\n"; |
| 77 | 100 |
| 78 const char kNoColor[] = "nocolor"; | 101 const char kNoColor[] = "nocolor"; |
| 79 const char kNoColor_HelpShort[] = | 102 const char kNoColor_HelpShort[] = |
| 80 "--nocolor: Force non-colored output."; | 103 "--nocolor: Force non-colored output."; |
| 81 const char kNoColor_Help[] = COLOR_HELP_LONG; | 104 const char kNoColor_Help[] = COLOR_HELP_LONG; |
| 82 | 105 |
| 83 const char kQuiet[] = "q"; | 106 const char kQuiet[] = "q"; |
| 84 const char kQuiet_HelpShort[] = | 107 const char kQuiet_HelpShort[] = |
| 85 "-q: Quiet mode. Don't print output on success."; | 108 "-q: Quiet mode. Don't print output on success."; |
| 86 const char kQuiet_Help[] = | 109 const char kQuiet_Help[] = |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 239 |
| 217 #define INSERT_VARIABLE(var) \ | 240 #define INSERT_VARIABLE(var) \ |
| 218 info_map[k##var] = SwitchInfo(k##var##_HelpShort, k##var##_Help); | 241 info_map[k##var] = SwitchInfo(k##var##_HelpShort, k##var##_Help); |
| 219 | 242 |
| 220 const SwitchInfoMap& GetSwitches() { | 243 const SwitchInfoMap& GetSwitches() { |
| 221 static SwitchInfoMap info_map; | 244 static SwitchInfoMap info_map; |
| 222 if (info_map.empty()) { | 245 if (info_map.empty()) { |
| 223 INSERT_VARIABLE(Args) | 246 INSERT_VARIABLE(Args) |
| 224 INSERT_VARIABLE(Color) | 247 INSERT_VARIABLE(Color) |
| 225 INSERT_VARIABLE(Dotfile) | 248 INSERT_VARIABLE(Dotfile) |
| 249 INSERT_VARIABLE(FailOnUnusedArgs) |
| 226 INSERT_VARIABLE(Markdown) | 250 INSERT_VARIABLE(Markdown) |
| 227 INSERT_VARIABLE(NoColor) | 251 INSERT_VARIABLE(NoColor) |
| 228 INSERT_VARIABLE(Root) | 252 INSERT_VARIABLE(Root) |
| 229 INSERT_VARIABLE(Quiet) | 253 INSERT_VARIABLE(Quiet) |
| 230 INSERT_VARIABLE(RuntimeDepsListFile) | 254 INSERT_VARIABLE(RuntimeDepsListFile) |
| 231 INSERT_VARIABLE(Threads) | 255 INSERT_VARIABLE(Threads) |
| 232 INSERT_VARIABLE(Time) | 256 INSERT_VARIABLE(Time) |
| 233 INSERT_VARIABLE(Tracelog) | 257 INSERT_VARIABLE(Tracelog) |
| 234 INSERT_VARIABLE(Verbose) | 258 INSERT_VARIABLE(Verbose) |
| 235 INSERT_VARIABLE(Version) | 259 INSERT_VARIABLE(Version) |
| 236 } | 260 } |
| 237 return info_map; | 261 return info_map; |
| 238 } | 262 } |
| 239 | 263 |
| 240 #undef INSERT_VARIABLE | 264 #undef INSERT_VARIABLE |
| 241 | 265 |
| 242 } // namespace switches | 266 } // namespace switches |
| OLD | NEW |