Chromium Code Reviews| 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" |
| 11 #include "tools/gn/build_settings.h" | 11 #include "tools/gn/build_settings.h" |
| 12 #include "tools/gn/commands.h" | 12 #include "tools/gn/commands.h" |
| 13 #include "tools/gn/eclipse_writer.h" | 13 #include "tools/gn/eclipse_writer.h" |
| 14 #include "tools/gn/ninja_target_writer.h" | 14 #include "tools/gn/ninja_target_writer.h" |
| 15 #include "tools/gn/ninja_writer.h" | 15 #include "tools/gn/ninja_writer.h" |
| 16 #include "tools/gn/qt_creator_writer.h" | |
| 16 #include "tools/gn/runtime_deps.h" | 17 #include "tools/gn/runtime_deps.h" |
| 17 #include "tools/gn/scheduler.h" | 18 #include "tools/gn/scheduler.h" |
| 18 #include "tools/gn/setup.h" | 19 #include "tools/gn/setup.h" |
| 19 #include "tools/gn/standard_out.h" | 20 #include "tools/gn/standard_out.h" |
| 20 #include "tools/gn/switches.h" | 21 #include "tools/gn/switches.h" |
| 21 #include "tools/gn/target.h" | 22 #include "tools/gn/target.h" |
| 22 #include "tools/gn/visual_studio_writer.h" | 23 #include "tools/gn/visual_studio_writer.h" |
| 23 | 24 |
| 24 namespace commands { | 25 namespace commands { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 const char kSwitchCheck[] = "check"; | 29 const char kSwitchCheck[] = "check"; |
| 29 const char kSwitchFilters[] = "filters"; | 30 const char kSwitchFilters[] = "filters"; |
| 30 const char kSwitchIde[] = "ide"; | 31 const char kSwitchIde[] = "ide"; |
| 31 const char kSwitchIdeValueEclipse[] = "eclipse"; | 32 const char kSwitchIdeValueEclipse[] = "eclipse"; |
| 33 const char kSwitchIdeValueQtCreator[] = "qtcreator"; | |
| 32 const char kSwitchIdeValueVs[] = "vs"; | 34 const char kSwitchIdeValueVs[] = "vs"; |
| 33 const char kSwitchIdeValueVs2013[] = "vs2013"; | 35 const char kSwitchIdeValueVs2013[] = "vs2013"; |
| 34 const char kSwitchIdeValueVs2015[] = "vs2015"; | 36 const char kSwitchIdeValueVs2015[] = "vs2015"; |
| 37 const char kSwitchRootProjectTarget[] = "root-project-target"; | |
| 35 const char kSwitchSln[] = "sln"; | 38 const char kSwitchSln[] = "sln"; |
| 36 | 39 |
| 37 // Called on worker thread to write the ninja file. | 40 // Called on worker thread to write the ninja file. |
| 38 void BackgroundDoWrite(const Target* target) { | 41 void BackgroundDoWrite(const Target* target) { |
| 39 NinjaTargetWriter::RunAndWriteFile(target); | 42 NinjaTargetWriter::RunAndWriteFile(target); |
| 40 g_scheduler->DecrementWorkCount(); | 43 g_scheduler->DecrementWorkCount(); |
| 41 } | 44 } |
| 42 | 45 |
| 43 // Called on the main thread. | 46 // Called on the main thread. |
| 44 void ItemResolvedCallback(base::subtle::Atomic32* write_counter, | 47 void ItemResolvedCallback(base::subtle::Atomic32* write_counter, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 if (command_line->HasSwitch(kSwitchFilters)) | 184 if (command_line->HasSwitch(kSwitchFilters)) |
| 182 filters = command_line->GetSwitchValueASCII(kSwitchFilters); | 185 filters = command_line->GetSwitchValueASCII(kSwitchFilters); |
| 183 bool res = VisualStudioWriter::RunAndWriteFiles( | 186 bool res = VisualStudioWriter::RunAndWriteFiles( |
| 184 build_settings, builder, version, sln_name, filters, err); | 187 build_settings, builder, version, sln_name, filters, err); |
| 185 if (res && !command_line->HasSwitch(switches::kQuiet)) { | 188 if (res && !command_line->HasSwitch(switches::kQuiet)) { |
| 186 OutputString("Generating Visual Studio projects took " + | 189 OutputString("Generating Visual Studio projects took " + |
| 187 base::Int64ToString(timer.Elapsed().InMilliseconds()) + | 190 base::Int64ToString(timer.Elapsed().InMilliseconds()) + |
| 188 "ms\n"); | 191 "ms\n"); |
| 189 } | 192 } |
| 190 return res; | 193 return res; |
| 194 } else if (ide == kSwitchIdeValueQtCreator) { | |
| 195 std::string root_target; | |
| 196 if (command_line->HasSwitch(kSwitchRootProjectTarget)) | |
| 197 root_target = command_line->GetSwitchValueASCII(kSwitchRootProjectTarget); | |
| 198 bool res = QtCreatorWriter::RunAndWriteFile(build_settings, builder, err, | |
| 199 root_target); | |
| 200 if (res && !command_line->HasSwitch(switches::kQuiet)) { | |
| 201 OutputString("Generating QtCreator project took " + | |
| 202 base::Int64ToString(timer.Elapsed().InMilliseconds()) + | |
| 203 "ms\n"); | |
| 204 } | |
| 205 return res; | |
| 191 } | 206 } |
| 192 | 207 |
| 193 *err = Err(Location(), "Unknown IDE: " + ide); | 208 *err = Err(Location(), "Unknown IDE: " + ide); |
| 194 return false; | 209 return false; |
| 195 } | 210 } |
| 196 | 211 |
| 197 } // namespace | 212 } // namespace |
| 198 | 213 |
| 199 const char kGen[] = "gen"; | 214 const char kGen[] = "gen"; |
| 200 const char kGen_HelpShort[] = | 215 const char kGen_HelpShort[] = |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 218 "\n" | 233 "\n" |
| 219 " GN optionally generates files for IDE. Possibilities for <ide options>\n" | 234 " GN optionally generates files for IDE. Possibilities for <ide options>\n" |
| 220 "\n" | 235 "\n" |
| 221 " --ide=<ide_name>\n" | 236 " --ide=<ide_name>\n" |
| 222 " Generate files for an IDE. Currently supported values:\n" | 237 " Generate files for an IDE. Currently supported values:\n" |
| 223 " \"eclipse\" - Eclipse CDT settings file.\n" | 238 " \"eclipse\" - Eclipse CDT settings file.\n" |
| 224 " \"vs\" - Visual Studio project/solution files.\n" | 239 " \"vs\" - Visual Studio project/solution files.\n" |
| 225 " (default Visual Studio version: 2015)\n" | 240 " (default Visual Studio version: 2015)\n" |
| 226 " \"vs2013\" - Visual Studio 2013 project/solution files.\n" | 241 " \"vs2013\" - Visual Studio 2013 project/solution files.\n" |
| 227 " \"vs2015\" - Visual Studio 2015 project/solution files.\n" | 242 " \"vs2015\" - Visual Studio 2015 project/solution files.\n" |
| 243 " \"qtcreator\" - QtCreator project directory." | |
|
brucedawson
2016/05/09 18:56:49
This should say "QtCreator project file.s" not "pr
Krzysztof Olczyk
2016/05/10 08:11:18
Done
| |
| 228 "\n" | 244 "\n" |
| 229 " --sln=<file_name>\n" | 245 " --sln=<file_name>\n" |
| 230 " Override default sln file name (\"all\"). Solution file is written\n" | 246 " Override default sln file name (\"all\"). Solution file is written\n" |
| 231 " to the root build directory. Only for Visual Studio.\n" | 247 " to the root build directory. Only for Visual Studio.\n" |
| 232 "\n" | 248 "\n" |
| 233 " --filters=<path_prefixes>\n" | 249 " --filters=<path_prefixes>\n" |
| 234 " Semicolon-separated list of label patterns used to limit the set\n" | 250 " Semicolon-separated list of label patterns used to limit the set\n" |
| 235 " of generated projects (see \"gn help label_pattern\"). Only\n" | 251 " of generated projects (see \"gn help label_pattern\"). Only\n" |
| 236 " matching targets will be included to the solution. Only for Visual\n" | 252 " matching targets will be included to the solution. Only for Visual\n" |
| 237 " Studio.\n" | 253 " Studio.\n" |
| 254 " --root-target=<target_name>\n" | |
| 255 " Name of the root target for which the project will be generated\n" | |
| 256 " to contain files of it and its dependencies. Omitting it traverses\n" | |
| 257 " the whole build graph. Only for QtCreator.\n" | |
| 238 "\n" | 258 "\n" |
| 239 "Eclipse IDE Support\n" | 259 "Eclipse IDE Support\n" |
| 240 "\n" | 260 "\n" |
| 241 " GN DOES NOT generate Eclipse CDT projects. Instead, it generates a\n" | 261 " GN DOES NOT generate Eclipse CDT projects. Instead, it generates a\n" |
| 242 " settings file which can be imported into an Eclipse CDT project. The\n" | 262 " settings file which can be imported into an Eclipse CDT project. The\n" |
| 243 " XML file contains a list of include paths and defines. Because GN does\n" | 263 " XML file contains a list of include paths and defines. Because GN does\n" |
| 244 " not generate a full .cproject definition, it is not possible to\n" | 264 " not generate a full .cproject definition, it is not possible to\n" |
| 245 " properly define includes/defines for each file individually.\n" | 265 " properly define includes/defines for each file individually.\n" |
| 246 " Instead, one set of includes/defines is generated for the entire\n" | 266 " Instead, one set of includes/defines is generated for the entire\n" |
| 247 " project. This works fairly well but may still result in a few indexer\n" | 267 " project. This works fairly well but may still result in a few indexer\n" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 setup->scheduler().input_file_manager()->GetInputFileCount()) + | 334 setup->scheduler().input_file_manager()->GetInputFileCount()) + |
| 315 " files in " + | 335 " files in " + |
| 316 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; | 336 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; |
| 317 OutputString(stats); | 337 OutputString(stats); |
| 318 } | 338 } |
| 319 | 339 |
| 320 return 0; | 340 return 0; |
| 321 } | 341 } |
| 322 | 342 |
| 323 } // namespace commands | 343 } // namespace commands |
| OLD | NEW |