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

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

Issue 1827103005: [GN] Add support for generating Xcode projects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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"
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/runtime_deps.h" 16 #include "tools/gn/runtime_deps.h"
17 #include "tools/gn/scheduler.h" 17 #include "tools/gn/scheduler.h"
18 #include "tools/gn/setup.h" 18 #include "tools/gn/setup.h"
19 #include "tools/gn/standard_out.h" 19 #include "tools/gn/standard_out.h"
20 #include "tools/gn/switches.h" 20 #include "tools/gn/switches.h"
21 #include "tools/gn/target.h" 21 #include "tools/gn/target.h"
22 #include "tools/gn/visual_studio_writer.h" 22 #include "tools/gn/visual_studio_writer.h"
23 #include "tools/gn/xcode_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";
32 const char kSwitchIdeValueVs[] = "vs"; 33 const char kSwitchIdeValueVs[] = "vs";
33 const char kSwitchIdeValueVs2013[] = "vs2013"; 34 const char kSwitchIdeValueVs2013[] = "vs2013";
34 const char kSwitchIdeValueVs2015[] = "vs2015"; 35 const char kSwitchIdeValueVs2015[] = "vs2015";
36 const char kSwitchIdeValueXcode[] = "xcode";
37 const char kSwitchNinjaExtraArgs[] = "ninja-extra-args";
38 const char kSwitchPattern[] = "pattern";
39 const char kSwitchRootTarget[] = "root-target";
35 const char kSwitchSln[] = "sln"; 40 const char kSwitchSln[] = "sln";
41 const char kSwitchWorkspace[] = "workspace";
36 42
37 // Called on worker thread to write the ninja file. 43 // Called on worker thread to write the ninja file.
38 void BackgroundDoWrite(const Target* target) { 44 void BackgroundDoWrite(const Target* target) {
39 NinjaTargetWriter::RunAndWriteFile(target); 45 NinjaTargetWriter::RunAndWriteFile(target);
40 g_scheduler->DecrementWorkCount(); 46 g_scheduler->DecrementWorkCount();
41 } 47 }
42 48
43 // Called on the main thread. 49 // Called on the main thread.
44 void ItemResolvedCallback(base::subtle::Atomic32* write_counter, 50 void ItemResolvedCallback(base::subtle::Atomic32* write_counter,
45 scoped_refptr<Builder> builder, 51 scoped_refptr<Builder> builder,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (command_line->HasSwitch(kSwitchFilters)) 187 if (command_line->HasSwitch(kSwitchFilters))
182 filters = command_line->GetSwitchValueASCII(kSwitchFilters); 188 filters = command_line->GetSwitchValueASCII(kSwitchFilters);
183 bool res = VisualStudioWriter::RunAndWriteFiles( 189 bool res = VisualStudioWriter::RunAndWriteFiles(
184 build_settings, builder, version, sln_name, filters, err); 190 build_settings, builder, version, sln_name, filters, err);
185 if (res && !command_line->HasSwitch(switches::kQuiet)) { 191 if (res && !command_line->HasSwitch(switches::kQuiet)) {
186 OutputString("Generating Visual Studio projects took " + 192 OutputString("Generating Visual Studio projects took " +
187 base::Int64ToString(timer.Elapsed().InMilliseconds()) + 193 base::Int64ToString(timer.Elapsed().InMilliseconds()) +
188 "ms\n"); 194 "ms\n");
189 } 195 }
190 return res; 196 return res;
197 } else if (ide == kSwitchIdeValueXcode) {
198 bool res = XcodeWriter::RunAndWriteFiles(
199 command_line->GetSwitchValueNative(kSwitchWorkspace),
200 command_line->GetSwitchValueNative(kSwitchRootTarget),
201 command_line->GetSwitchValueNative(kSwitchNinjaExtraArgs),
202 command_line->GetSwitchValueNative(kSwitchPattern), build_settings,
203 builder, err);
204 if (res && !command_line->HasSwitch(switches::kQuiet)) {
205 OutputString("Generating Xcode projects took " +
206 base::Int64ToString(timer.Elapsed().InMilliseconds()) +
207 "ms\n");
208 }
209 return res;
191 } 210 }
192 211
193 *err = Err(Location(), "Unknown IDE: " + ide); 212 *err = Err(Location(), "Unknown IDE: " + ide);
194 return false; 213 return false;
195 } 214 }
196 215
197 } // namespace 216 } // namespace
198 217
199 const char kGen[] = "gen"; 218 const char kGen[] = "gen";
200 const char kGen_HelpShort[] = 219 const char kGen_HelpShort[] =
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 setup->scheduler().input_file_manager()->GetInputFileCount()) + 333 setup->scheduler().input_file_manager()->GetInputFileCount()) +
315 " files in " + 334 " files in " +
316 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n"; 335 base::Int64ToString(elapsed_time.InMilliseconds()) + "ms\n";
317 OutputString(stats); 336 OutputString(stats);
318 } 337 }
319 338
320 return 0; 339 return 0;
321 } 340 }
322 341
323 } // namespace commands 342 } // namespace commands
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698