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 "base/atomicops.h" | 5 #include "base/atomicops.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/timer/elapsed_timer.h" | 10 #include "base/timer/elapsed_timer.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 *err = Err(Location(), "Unknown IDE: " + ide); | 265 *err = Err(Location(), "Unknown IDE: " + ide); |
266 return false; | 266 return false; |
267 } | 267 } |
268 | 268 |
269 } // namespace | 269 } // namespace |
270 | 270 |
271 const char kGen[] = "gen"; | 271 const char kGen[] = "gen"; |
272 const char kGen_HelpShort[] = "gen: Generate ninja files."; | 272 const char kGen_HelpShort[] = "gen: Generate ninja files."; |
273 const char kGen_Help[] = | 273 const char kGen_Help[] = |
274 "gn gen: Generate ninja files.\n" | 274 R"(gn gen: Generate ninja files. |
275 "\n" | 275 |
276 " gn gen [<ide options>] <out_dir>\n" | 276 gn gen [<ide options>] <out_dir> |
277 "\n" | 277 |
278 " Generates ninja files from the current tree and puts them in the given\n" | 278 Generates ninja files from the current tree and puts them in the given output |
279 " output directory.\n" | 279 directory. |
280 "\n" | 280 |
281 " The output directory can be a source-repo-absolute path name such as:\n" | 281 The output directory can be a source-repo-absolute path name such as: |
282 " //out/foo\n" | 282 //out/foo |
283 " Or it can be a directory relative to the current directory such as:\n" | 283 Or it can be a directory relative to the current directory such as: |
284 " out/foo\n" | 284 out/foo |
285 "\n" | 285 |
286 " See \"gn help switches\" for the common command-line switches.\n" | 286 See "gn help switches" for the common command-line switches. |
287 "\n" | 287 |
288 "IDE options\n" | 288 IDE options |
289 "\n" | 289 |
290 " GN optionally generates files for IDE. Possibilities for <ide options>\n" | 290 GN optionally generates files for IDE. Possibilities for <ide options> |
291 "\n" | 291 |
292 " --ide=<ide_name>\n" | 292 --ide=<ide_name> |
293 " Generate files for an IDE. Currently supported values:\n" | 293 Generate files for an IDE. Currently supported values: |
294 " \"eclipse\" - Eclipse CDT settings file.\n" | 294 "eclipse" - Eclipse CDT settings file. |
295 " \"vs\" - Visual Studio project/solution files.\n" | 295 "vs" - Visual Studio project/solution files. |
296 " (default Visual Studio version: 2015)\n" | 296 (default Visual Studio version: 2015) |
297 " \"vs2013\" - Visual Studio 2013 project/solution files.\n" | 297 "vs2013" - Visual Studio 2013 project/solution files. |
298 " \"vs2015\" - Visual Studio 2015 project/solution files.\n" | 298 "vs2015" - Visual Studio 2015 project/solution files. |
299 " \"xcode\" - Xcode workspace/solution files.\n" | 299 "xcode" - Xcode workspace/solution files. |
300 " \"qtcreator\" - QtCreator project files.\n" | 300 "qtcreator" - QtCreator project files. |
301 " \"json\" - JSON file containing target information\n" | 301 "json" - JSON file containing target information |
302 "\n" | 302 |
303 " --filters=<path_prefixes>\n" | 303 --filters=<path_prefixes> |
304 " Semicolon-separated list of label patterns used to limit the set\n" | 304 Semicolon-separated list of label patterns used to limit the set of |
305 " of generated projects (see \"gn help label_pattern\"). Only\n" | 305 generated projects (see "gn help label_pattern"). Only matching targets |
306 " matching targets and their dependencies will be included in the\n" | 306 and their dependencies will be included in the solution. Only used for |
307 " solution. Only used for Visual Studio, Xcode and JSON.\n" | 307 Visual Studio, Xcode and JSON. |
308 "\n" | 308 |
309 "Visual Studio Flags\n" | 309 Visual Studio Flags |
310 "\n" | 310 |
311 " --sln=<file_name>\n" | 311 --sln=<file_name> |
312 " Override default sln file name (\"all\"). Solution file is written\n" | 312 Override default sln file name ("all"). Solution file is written to the |
313 " to the root build directory.\n" | 313 root build directory. |
314 "\n" | 314 |
315 " --no-deps\n" | 315 --no-deps |
316 " Don't include targets dependencies to the solution. Changes the\n" | 316 Don't include targets dependencies to the solution. Changes the way how |
317 " way how --filters option works. Only directly matching targets are\n" | 317 --filters option works. Only directly matching targets are included. |
318 " included.\n" | 318 |
319 "\n" | 319 Xcode Flags |
320 "Xcode Flags\n" | 320 |
321 "\n" | 321 --workspace=<file_name> |
322 " --workspace=<file_name>\n" | 322 Override defaut workspace file name ("all"). The workspace file is |
323 " Override defaut workspace file name (\"all\"). The workspace file\n" | 323 written to the root build directory. |
324 " is written to the root build directory.\n" | 324 |
325 "\n" | 325 --ninja-extra-args=<string> |
326 " --ninja-extra-args=<string>\n" | 326 This string is passed without any quoting to the ninja invocation |
327 " This string is passed without any quoting to the ninja invocation\n" | 327 command-line. Can be used to configure ninja flags, like "-j" if using |
328 " command-line. Can be used to configure ninja flags, like \"-j\" if\n" | 328 goma for example. |
329 " using goma for example.\n" | 329 |
330 "\n" | 330 --root-target=<target_name> |
331 " --root-target=<target_name>\n" | 331 Name of the target corresponding to "All" target in Xcode. If unset, |
332 " Name of the target corresponding to \"All\" target in Xcode.\n" | 332 "All" invokes ninja without any target and builds everything. |
333 " If unset, \"All\" invokes ninja without any target\n" | 333 |
334 " and builds everything.\n" | 334 QtCreator Flags |
335 "\n" | 335 |
336 "QtCreator Flags\n" | 336 --root-target=<target_name> |
337 "\n" | 337 Name of the root target for which the QtCreator project will be generated |
338 " --root-target=<target_name>\n" | 338 to contain files of it and its dependencies. If unset, the whole build |
339 " Name of the root target for which the QtCreator project will be\n" | 339 graph will be emitted. |
340 " generated to contain files of it and its dependencies. If unset, \n" | 340 |
341 " the whole build graph will be emitted.\n" | 341 |
342 "\n" | 342 Eclipse IDE Support |
343 "\n" | 343 |
344 "Eclipse IDE Support\n" | 344 GN DOES NOT generate Eclipse CDT projects. Instead, it generates a settings |
345 "\n" | 345 file which can be imported into an Eclipse CDT project. The XML file contains |
346 " GN DOES NOT generate Eclipse CDT projects. Instead, it generates a\n" | 346 a list of include paths and defines. Because GN does not generate a full |
347 " settings file which can be imported into an Eclipse CDT project. The\n" | 347 .cproject definition, it is not possible to properly define includes/defines |
348 " XML file contains a list of include paths and defines. Because GN does\n" | 348 for each file individually. Instead, one set of includes/defines is generated |
349 " not generate a full .cproject definition, it is not possible to\n" | 349 for the entire project. This works fairly well but may still result in a few |
350 " properly define includes/defines for each file individually.\n" | 350 indexer issues here and there. |
351 " Instead, one set of includes/defines is generated for the entire\n" | 351 |
352 " project. This works fairly well but may still result in a few indexer\n" | 352 Generic JSON Output |
353 " issues here and there.\n" | 353 |
354 "\n" | 354 Dumps target information to JSON file and optionally invokes python script on |
355 "Generic JSON Output\n" | 355 generated file. See comments at the beginning of json_project_writer.cc and |
356 "\n" | 356 desc_builder.cc for overview of JSON file format. |
357 " Dumps target information to JSON file and optionally invokes python\n" | 357 |
358 " script on generated file.\n" | 358 --json-file-name=<json_file_name> |
359 " See comments at the beginning of json_project_writer.cc and\n" | 359 Overrides default file name (project.json) of generated JSON file. |
360 " desc_builder.cc for overview of JSON file format.\n" | 360 |
361 "\n" | 361 --json-ide-script=<path_to_python_script> |
362 " --json-file-name=<json_file_name>\n" | 362 Executes python script after the JSON file is generated. Path can be |
363 " Overrides default file name (project.json) of generated JSON file.\n" | 363 project absolute (//), system absolute (/) or relative, in which case the |
364 "\n" | 364 output directory will be base. Path to generated JSON file will be first |
365 " --json-ide-script=<path_to_python_script>\n" | 365 argument when invoking script. |
366 " Executes python script after the JSON file is generated.\n" | 366 |
367 " Path can be project absolute (//), system absolute (/) or\n" | 367 --json-ide-script-args=<argument> |
368 " relative, in which case the output directory will be base.\n" | 368 Optional second argument that will passed to executed script. |
369 " Path to generated JSON file will be first argument when invoking\n" | 369 )"; |
370 " script.\n" | |
371 "\n" | |
372 " --json-ide-script-args=<argument>\n" | |
373 " Optional second argument that will passed to executed script.\n"; | |
374 | 370 |
375 int RunGen(const std::vector<std::string>& args) { | 371 int RunGen(const std::vector<std::string>& args) { |
376 base::ElapsedTimer timer; | 372 base::ElapsedTimer timer; |
377 | 373 |
378 if (args.size() != 1) { | 374 if (args.size() != 1) { |
379 Err(Location(), "Need exactly one build directory to generate.", | 375 Err(Location(), "Need exactly one build directory to generate.", |
380 "I expected something more like \"gn gen out/foo\"\n" | 376 "I expected something more like \"gn gen out/foo\"\n" |
381 "You can also see \"gn help gen\".").PrintToStdout(); | 377 "You can also see \"gn help gen\".").PrintToStdout(); |
382 return 1; | 378 return 1; |
383 } | 379 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 setup->scheduler().input_file_manager()->GetInputFileCount()) + | 447 setup->scheduler().input_file_manager()->GetInputFileCount()) + |
452 " files in " + | 448 " files in " + |
453 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; | 449 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; |
454 OutputString(stats); | 450 OutputString(stats); |
455 } | 451 } |
456 | 452 |
457 return 0; | 453 return 0; |
458 } | 454 } |
459 | 455 |
460 } // namespace commands | 456 } // namespace commands |
OLD | NEW |