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

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

Issue 2200123002: Add option to not generate VS projects for targets deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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 "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 21 matching lines...) Expand all
32 const char kSwitchFilters[] = "filters"; 32 const char kSwitchFilters[] = "filters";
33 const char kSwitchIde[] = "ide"; 33 const char kSwitchIde[] = "ide";
34 const char kSwitchIdeValueEclipse[] = "eclipse"; 34 const char kSwitchIdeValueEclipse[] = "eclipse";
35 const char kSwitchIdeValueQtCreator[] = "qtcreator"; 35 const char kSwitchIdeValueQtCreator[] = "qtcreator";
36 const char kSwitchIdeValueVs[] = "vs"; 36 const char kSwitchIdeValueVs[] = "vs";
37 const char kSwitchIdeValueVs2013[] = "vs2013"; 37 const char kSwitchIdeValueVs2013[] = "vs2013";
38 const char kSwitchIdeValueVs2015[] = "vs2015"; 38 const char kSwitchIdeValueVs2015[] = "vs2015";
39 const char kSwitchIdeValueXcode[] = "xcode"; 39 const char kSwitchIdeValueXcode[] = "xcode";
40 const char kSwitchIdeValueJson[] = "json"; 40 const char kSwitchIdeValueJson[] = "json";
41 const char kSwitchNinjaExtraArgs[] = "ninja-extra-args"; 41 const char kSwitchNinjaExtraArgs[] = "ninja-extra-args";
42 const char kSwitchNoDeps[] = "no-deps";
42 const char kSwitchRootTarget[] = "root-target"; 43 const char kSwitchRootTarget[] = "root-target";
43 const char kSwitchSln[] = "sln"; 44 const char kSwitchSln[] = "sln";
44 const char kSwitchWorkspace[] = "workspace"; 45 const char kSwitchWorkspace[] = "workspace";
45 const char kSwitchJsonFileName[] = "json-file-name"; 46 const char kSwitchJsonFileName[] = "json-file-name";
46 const char kSwitchJsonIdeScript[] = "json-ide-script"; 47 const char kSwitchJsonIdeScript[] = "json-ide-script";
47 const char kSwitchJsonIdeScriptArgs[] = "json-ide-script-args"; 48 const char kSwitchJsonIdeScriptArgs[] = "json-ide-script-args";
48 49
49 // Collects Ninja rules for each toolchain. The lock protectes the rules. 50 // Collects Ninja rules for each toolchain. The lock protectes the rules.
50 struct TargetWriteInfo { 51 struct TargetWriteInfo {
51 base::Lock lock; 52 base::Lock lock;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 ide == kSwitchIdeValueVs2015) { 199 ide == kSwitchIdeValueVs2015) {
199 VisualStudioWriter::Version version = 200 VisualStudioWriter::Version version =
200 ide == kSwitchIdeValueVs2013 ? VisualStudioWriter::Version::Vs2013 201 ide == kSwitchIdeValueVs2013 ? VisualStudioWriter::Version::Vs2013
201 : VisualStudioWriter::Version::Vs2015; 202 : VisualStudioWriter::Version::Vs2015;
202 std::string sln_name; 203 std::string sln_name;
203 if (command_line->HasSwitch(kSwitchSln)) 204 if (command_line->HasSwitch(kSwitchSln))
204 sln_name = command_line->GetSwitchValueASCII(kSwitchSln); 205 sln_name = command_line->GetSwitchValueASCII(kSwitchSln);
205 std::string filters; 206 std::string filters;
206 if (command_line->HasSwitch(kSwitchFilters)) 207 if (command_line->HasSwitch(kSwitchFilters))
207 filters = command_line->GetSwitchValueASCII(kSwitchFilters); 208 filters = command_line->GetSwitchValueASCII(kSwitchFilters);
209 bool no_deps = command_line->HasSwitch(kSwitchNoDeps);
208 bool res = VisualStudioWriter::RunAndWriteFiles( 210 bool res = VisualStudioWriter::RunAndWriteFiles(
209 build_settings, builder, version, sln_name, filters, err); 211 build_settings, builder, version, sln_name, filters, no_deps, err);
210 if (res && !quiet) { 212 if (res && !quiet) {
211 OutputString("Generating Visual Studio projects took " + 213 OutputString("Generating Visual Studio projects took " +
212 base::Int64ToString(timer.Elapsed().InMilliseconds()) + 214 base::Int64ToString(timer.Elapsed().InMilliseconds()) +
213 "ms\n"); 215 "ms\n");
214 } 216 }
215 return res; 217 return res;
216 } else if (ide == kSwitchIdeValueXcode) { 218 } else if (ide == kSwitchIdeValueXcode) {
217 bool res = XcodeWriter::RunAndWriteFiles( 219 bool res = XcodeWriter::RunAndWriteFiles(
218 command_line->GetSwitchValueASCII(kSwitchWorkspace), 220 command_line->GetSwitchValueASCII(kSwitchWorkspace),
219 command_line->GetSwitchValueASCII(kSwitchRootTarget), 221 command_line->GetSwitchValueASCII(kSwitchRootTarget),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 " of generated projects (see \"gn help label_pattern\"). Only\n" 305 " of generated projects (see \"gn help label_pattern\"). Only\n"
304 " matching targets and their dependencies will be included in the\n" 306 " matching targets and their dependencies will be included in the\n"
305 " solution. Only used for Visual Studio, Xcode and JSON.\n" 307 " solution. Only used for Visual Studio, Xcode and JSON.\n"
306 "\n" 308 "\n"
307 "Visual Studio Flags\n" 309 "Visual Studio Flags\n"
308 "\n" 310 "\n"
309 " --sln=<file_name>\n" 311 " --sln=<file_name>\n"
310 " Override default sln file name (\"all\"). Solution file is written\n" 312 " Override default sln file name (\"all\"). Solution file is written\n"
311 " to the root build directory.\n" 313 " to the root build directory.\n"
312 "\n" 314 "\n"
315 " --no-deps\n"
316 " Don't include targets dependencies to the solution. Changes the\n"
317 " way how --filters option works. Only directly matching targets are\n"
318 " included.\n"
319 "\n"
313 "Xcode Flags\n" 320 "Xcode Flags\n"
314 "\n" 321 "\n"
315 " --workspace=<file_name>\n" 322 " --workspace=<file_name>\n"
316 " Override defaut workspace file name (\"all\"). The workspace file\n" 323 " Override defaut workspace file name (\"all\"). The workspace file\n"
317 " is written to the root build directory.\n" 324 " is written to the root build directory.\n"
318 "\n" 325 "\n"
319 " --ninja-extra-args=<string>\n" 326 " --ninja-extra-args=<string>\n"
320 " This string is passed without any quoting to the ninja invocation\n" 327 " This string is passed without any quoting to the ninja invocation\n"
321 " command-line. Can be used to configure ninja flags, like \"-j\" if\n" 328 " command-line. Can be used to configure ninja flags, like \"-j\" if\n"
322 " using goma for example.\n" 329 " using goma for example.\n"
(...skipping 18 matching lines...) Expand all
341 " XML file contains a list of include paths and defines. Because GN does\n" 348 " XML file contains a list of include paths and defines. Because GN does\n"
342 " not generate a full .cproject definition, it is not possible to\n" 349 " not generate a full .cproject definition, it is not possible to\n"
343 " properly define includes/defines for each file individually.\n" 350 " properly define includes/defines for each file individually.\n"
344 " Instead, one set of includes/defines is generated for the entire\n" 351 " Instead, one set of includes/defines is generated for the entire\n"
345 " project. This works fairly well but may still result in a few indexer\n" 352 " project. This works fairly well but may still result in a few indexer\n"
346 " issues here and there.\n" 353 " issues here and there.\n"
347 "\n" 354 "\n"
348 "Generic JSON Output\n" 355 "Generic JSON Output\n"
349 "\n" 356 "\n"
350 " Dumps target information to JSON file and optionally invokes python\n" 357 " Dumps target information to JSON file and optionally invokes python\n"
351 " script on generated file. \n" 358 " script on generated file.\n"
352 " See comments at the beginning of json_project_writer.cc and\n" 359 " See comments at the beginning of json_project_writer.cc and\n"
353 " desc_builder.cc for overview of JSON file format.\n" 360 " desc_builder.cc for overview of JSON file format.\n"
354 "\n" 361 "\n"
355 " --json-file-name=<json_file_name>\n" 362 " --json-file-name=<json_file_name>\n"
356 " Overrides default file name (project.json) of generated JSON file.\n" 363 " Overrides default file name (project.json) of generated JSON file.\n"
357 "\n" 364 "\n"
358 " --json-ide-script=<path_to_python_script>\n" 365 " --json-ide-script=<path_to_python_script>\n"
359 " Executes python script after the JSON file is generated.\n" 366 " Executes python script after the JSON file is generated.\n"
360 " Path can be project absolute (//), system absolute (/) or\n" 367 " Path can be project absolute (//), system absolute (/) or\n"
361 " relative, in which case the output directory will be base.\n" 368 " relative, in which case the output directory will be base.\n"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 setup->scheduler().input_file_manager()->GetInputFileCount()) + 451 setup->scheduler().input_file_manager()->GetInputFileCount()) +
445 " files in " + 452 " files in " +
446 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; 453 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n";
447 OutputString(stats); 454 OutputString(stats);
448 } 455 }
449 456
450 return 0; 457 return 0;
451 } 458 }
452 459
453 } // namespace commands 460 } // namespace commands
OLDNEW
« no previous file with comments | « no previous file | tools/gn/docs/reference.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698