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

Unified Diff: tools/gn/command_gen.cc

Issue 1718093006: Limit the set of Visual Studio projects generated by GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto current master + review and comment fix Created 4 years, 10 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 | « no previous file | tools/gn/visual_studio_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_gen.cc
diff --git a/tools/gn/command_gen.cc b/tools/gn/command_gen.cc
index b5ffc1494807d159b139cb0289ce834dbe7ddc7d..fee3f1a31f836c7843eac42afdeb918722c43413 100644
--- a/tools/gn/command_gen.cc
+++ b/tools/gn/command_gen.cc
@@ -26,11 +26,13 @@ namespace commands {
namespace {
const char kSwitchCheck[] = "check";
+const char kSwitchFilters[] = "filters";
const char kSwitchIde[] = "ide";
const char kSwitchIdeValueEclipse[] = "eclipse";
const char kSwitchIdeValueVs[] = "vs";
const char kSwitchIdeValueVs2013[] = "vs2013";
const char kSwitchIdeValueVs2015[] = "vs2015";
+const char kSwitchSln[] = "sln";
// Called on worker thread to write the ninja file.
void BackgroundDoWrite(const Target* target) {
@@ -155,11 +157,13 @@ bool RunIdeWriter(const std::string& ide,
const BuildSettings* build_settings,
Builder* builder,
Err* err) {
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
base::ElapsedTimer timer;
+
if (ide == kSwitchIdeValueEclipse) {
bool res = EclipseWriter::RunAndWriteFile(build_settings, builder, err);
- if (res &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kQuiet)) {
+ if (res && !command_line->HasSwitch(switches::kQuiet)) {
OutputString("Generating Eclipse settings took " +
base::Int64ToString(timer.Elapsed().InMilliseconds()) +
"ms\n");
@@ -170,10 +174,15 @@ bool RunIdeWriter(const std::string& ide,
VisualStudioWriter::Version version =
ide == kSwitchIdeValueVs2013 ? VisualStudioWriter::Version::Vs2013
: VisualStudioWriter::Version::Vs2015;
- bool res = VisualStudioWriter::RunAndWriteFiles(build_settings, builder,
- version, err);
- if (res &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kQuiet)) {
+ std::string sln_name;
+ if (command_line->HasSwitch(kSwitchSln))
+ sln_name = command_line->GetSwitchValueASCII(kSwitchSln);
+ std::string filters;
+ if (command_line->HasSwitch(kSwitchFilters))
+ filters = command_line->GetSwitchValueASCII(kSwitchFilters);
+ bool res = VisualStudioWriter::RunAndWriteFiles(
+ build_settings, builder, version, sln_name, filters, err);
+ if (res && !command_line->HasSwitch(switches::kQuiet)) {
OutputString("Generating Visual Studio projects took " +
base::Int64ToString(timer.Elapsed().InMilliseconds()) +
"ms\n");
@@ -193,7 +202,7 @@ const char kGen_HelpShort[] =
const char kGen_Help[] =
"gn gen: Generate ninja files.\n"
"\n"
- " gn gen [--ide=<ide_name>] <out_dir>\n"
+ " gn gen [<ide options>] <out_dir>\n"
"\n"
" Generates ninja files from the current tree and puts them in the given\n"
" output directory.\n"
@@ -203,15 +212,29 @@ const char kGen_Help[] =
" Or it can be a directory relative to the current directory such as:\n"
" out/foo\n"
"\n"
+ " See \"gn help switches\" for the common command-line switches.\n"
+ "\n"
+ "IDE options\n"
+ "\n"
+ " GN optionally generates files for IDE. Possibilities for <ide options>\n"
+ "\n"
" --ide=<ide_name>\n"
- " Also generate files for an IDE. Currently supported values:\n"
+ " Generate files for an IDE. Currently supported values:\n"
" \"eclipse\" - Eclipse CDT settings file.\n"
" \"vs\" - Visual Studio project/solution files.\n"
" (default Visual Studio version: 2015)\n"
" \"vs2013\" - Visual Studio 2013 project/solution files.\n"
" \"vs2015\" - Visual Studio 2015 project/solution files.\n"
"\n"
- " See \"gn help switches\" for the common command-line switches.\n"
+ " --sln=<file_name>\n"
+ " Override default sln file name (\"all\"). Solution file is written\n"
+ " to the root build directory. Only for Visual Studio.\n"
+ "\n"
+ " --filters=<path_prefixes>\n"
+ " Semicolon-separated list of label patterns used to limit the set\n"
+ " of generated projects (see \"gn help label_pattern\"). Only\n"
+ " matching targets will be included to the solution. Only for Visual\n"
+ " Studio.\n"
"\n"
"Eclipse IDE Support\n"
"\n"
« no previous file with comments | « no previous file | tools/gn/visual_studio_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698