| 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 11 matching lines...) Expand all Loading... |
| 22 #include "tools/gn/visual_studio_writer.h" | 22 #include "tools/gn/visual_studio_writer.h" |
| 23 | 23 |
| 24 namespace commands { | 24 namespace commands { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const char kSwitchCheck[] = "check"; | 28 const char kSwitchCheck[] = "check"; |
| 29 const char kSwitchIde[] = "ide"; | 29 const char kSwitchIde[] = "ide"; |
| 30 const char kSwitchIdeValueEclipse[] = "eclipse"; | 30 const char kSwitchIdeValueEclipse[] = "eclipse"; |
| 31 const char kSwitchIdeValueVs[] = "vs"; | 31 const char kSwitchIdeValueVs[] = "vs"; |
| 32 const char kSwitchIdeValueVs2013[] = "vs2013"; |
| 33 const char kSwitchIdeValueVs2015[] = "vs2015"; |
| 32 | 34 |
| 33 // Called on worker thread to write the ninja file. | 35 // Called on worker thread to write the ninja file. |
| 34 void BackgroundDoWrite(const Target* target) { | 36 void BackgroundDoWrite(const Target* target) { |
| 35 NinjaTargetWriter::RunAndWriteFile(target); | 37 NinjaTargetWriter::RunAndWriteFile(target); |
| 36 g_scheduler->DecrementWorkCount(); | 38 g_scheduler->DecrementWorkCount(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 // Called on the main thread. | 41 // Called on the main thread. |
| 40 void ItemResolvedCallback(base::subtle::Atomic32* write_counter, | 42 void ItemResolvedCallback(base::subtle::Atomic32* write_counter, |
| 41 scoped_refptr<Builder> builder, | 43 scoped_refptr<Builder> builder, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return false; | 151 return false; |
| 150 } | 152 } |
| 151 | 153 |
| 152 bool RunIdeWriter(const std::string& ide, | 154 bool RunIdeWriter(const std::string& ide, |
| 153 const BuildSettings* build_settings, | 155 const BuildSettings* build_settings, |
| 154 Builder* builder, | 156 Builder* builder, |
| 155 Err* err) { | 157 Err* err) { |
| 156 base::ElapsedTimer timer; | 158 base::ElapsedTimer timer; |
| 157 if (ide == kSwitchIdeValueEclipse) { | 159 if (ide == kSwitchIdeValueEclipse) { |
| 158 bool res = EclipseWriter::RunAndWriteFile(build_settings, builder, err); | 160 bool res = EclipseWriter::RunAndWriteFile(build_settings, builder, err); |
| 159 if (res) { | 161 if (res && |
| 162 !base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kQuiet)) { |
| 160 OutputString("Generating Eclipse settings took " + | 163 OutputString("Generating Eclipse settings took " + |
| 161 base::Int64ToString(timer.Elapsed().InMilliseconds()) + | 164 base::Int64ToString(timer.Elapsed().InMilliseconds()) + |
| 162 "ms\n"); | 165 "ms\n"); |
| 163 } | 166 } |
| 164 return res; | 167 return res; |
| 165 } else if (ide == kSwitchIdeValueVs) { | 168 } else if (ide == kSwitchIdeValueVs || ide == kSwitchIdeValueVs2013 || |
| 166 bool res = | 169 ide == kSwitchIdeValueVs2015) { |
| 167 VisualStudioWriter::RunAndWriteFiles(build_settings, builder, err); | 170 VisualStudioWriter::Version version = |
| 171 ide == kSwitchIdeValueVs2013 ? VisualStudioWriter::Version::Vs2013 |
| 172 : VisualStudioWriter::Version::Vs2015; |
| 173 bool res = VisualStudioWriter::RunAndWriteFiles(build_settings, builder, |
| 174 version, err); |
| 168 if (res && | 175 if (res && |
| 169 !base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kQuiet)) { | 176 !base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kQuiet)) { |
| 170 OutputString("Generating Visual Studio projects took " + | 177 OutputString("Generating Visual Studio projects took " + |
| 171 base::Int64ToString(timer.Elapsed().InMilliseconds()) + | 178 base::Int64ToString(timer.Elapsed().InMilliseconds()) + |
| 172 "ms\n"); | 179 "ms\n"); |
| 173 } | 180 } |
| 174 return res; | 181 return res; |
| 175 } | 182 } |
| 176 | 183 |
| 177 *err = Err(Location(), "Unknown IDE: " + ide); | 184 *err = Err(Location(), "Unknown IDE: " + ide); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 191 " Generates ninja files from the current tree and puts them in the given\n" | 198 " Generates ninja files from the current tree and puts them in the given\n" |
| 192 " output directory.\n" | 199 " output directory.\n" |
| 193 "\n" | 200 "\n" |
| 194 " The output directory can be a source-repo-absolute path name such as:\n" | 201 " The output directory can be a source-repo-absolute path name such as:\n" |
| 195 " //out/foo\n" | 202 " //out/foo\n" |
| 196 " Or it can be a directory relative to the current directory such as:\n" | 203 " Or it can be a directory relative to the current directory such as:\n" |
| 197 " out/foo\n" | 204 " out/foo\n" |
| 198 "\n" | 205 "\n" |
| 199 " --ide=<ide_name>\n" | 206 " --ide=<ide_name>\n" |
| 200 " Also generate files for an IDE. Currently supported values:\n" | 207 " Also generate files for an IDE. Currently supported values:\n" |
| 201 " 'vs' - Visual Studio project/solution files.\n" | 208 " \"eclipse\" - Eclipse CDT settings file.\n" |
| 202 " 'eclipse' - Eclipse CDT settings file.\n" | 209 " \"vs\" - Visual Studio project/solution files.\n" |
| 210 " (default Visual Studio version: 2015)\n" |
| 211 " \"vs2013\" - Visual Studio 2013 project/solution files.\n" |
| 212 " \"vs2015\" - Visual Studio 2015 project/solution files.\n" |
| 203 "\n" | 213 "\n" |
| 204 " See \"gn help switches\" for the common command-line switches.\n" | 214 " See \"gn help switches\" for the common command-line switches.\n" |
| 205 "\n" | 215 "\n" |
| 206 "Eclipse IDE Support\n" | 216 "Eclipse IDE Support\n" |
| 207 "\n" | 217 "\n" |
| 208 " GN DOES NOT generate Eclipse CDT projects. Instead, it generates a\n" | 218 " GN DOES NOT generate Eclipse CDT projects. Instead, it generates a\n" |
| 209 " settings file which can be imported into an Eclipse CDT project. The\n" | 219 " settings file which can be imported into an Eclipse CDT project. The\n" |
| 210 " XML file contains a list of include paths and defines. Because GN does\n" | 220 " XML file contains a list of include paths and defines. Because GN does\n" |
| 211 " not generate a full .cproject definition, it is not possible to\n" | 221 " not generate a full .cproject definition, it is not possible to\n" |
| 212 " properly define includes/defines for each file individually.\n" | 222 " properly define includes/defines for each file individually.\n" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 setup->scheduler().input_file_manager()->GetInputFileCount()) + | 291 setup->scheduler().input_file_manager()->GetInputFileCount()) + |
| 282 " files in " + | 292 " files in " + |
| 283 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; | 293 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; |
| 284 OutputString(stats); | 294 OutputString(stats); |
| 285 } | 295 } |
| 286 | 296 |
| 287 return 0; | 297 return 0; |
| 288 } | 298 } |
| 289 | 299 |
| 290 } // namespace commands | 300 } // namespace commands |
| OLD | NEW |