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

Side by Side Diff: tools/gn/xcode_writer.h

Issue 1827103005: [GN] Add support for generating Xcode projects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add documentation for new flags to "gn gen" 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef TOOLS_GN_XCODE_WRITER_H_
6 #define TOOLS_GN_XCODE_WRITER_H_
7
8 #include <iosfwd>
9 #include <map>
10 #include <memory>
11 #include <string>
12 #include <vector>
13
14 #include "base/macros.h"
15
16 class Builder;
17 class BuildSettings;
18 class Err;
19 class SourceDir;
20 class Target;
21
22 using PBXAttributes = std::map<std::string, std::string>;
23 class PBXProject;
24
25 class XcodeWriter {
26 public:
27 enum TargetOsType {
28 WRITER_TARGET_OS_IOS,
29 WRITER_TARGET_OS_MACOS,
30 };
31
32 // Writes Xcode workspace and project files.
33 //
34 // |workspace_name| is the optional name of the workspace file name ("all"
35 // is used if not specified). |root_target_name| is the name of the main
36 // target corresponding to building "All" (for example "gn_all" in Chromium).
37 // |ninja_extra_args| are additional arguments to pass to ninja invocation
38 // (can be used to increase limit of concurrent processes when using goma).
39 // |target_filter_pattern| is a regular expression used to filter the targets
40 // to generate. If not set, all targets are present in the generated project.
41 //
42 // On failure will populate |err| and return false.
43 static bool RunAndWriteFiles(const std::string& workspace_name,
44 const std::string& root_target_name,
45 const std::string& ninja_extra_args,
46 const std::string& target_filter_pattern,
47 const BuildSettings* build_settings,
48 Builder* builder,
49 Err* err);
50
51 private:
52 XcodeWriter(const std::string& name);
53 ~XcodeWriter();
54
55 static std::vector<const Target*> FilterTargets(
56 const std::vector<const Target*>& all_targets,
57 const std::string& target_filter_pattern);
58
59 void CreateMainProject(const std::vector<const Target*>& targets,
60 const PBXAttributes& attributes,
61 const std::string& project_name,
62 const std::string& source_path,
63 const std::string& config_name,
64 const std::string& root_target,
65 const std::string& ninja_extra_args,
66 const std::string& target_filter_pattern,
67 TargetOsType target_os);
68
69 void CreateSourceForIndexingProject(const std::vector<const Target*>& targets,
70 const SourceDir& root_build_dir,
71 const PBXAttributes& attributes,
72 const std::string& project_name,
73 const std::string& source_path,
74 const std::string& config_name,
75 TargetOsType target_os);
76
77 bool WriteFiles(const BuildSettings* build_settings, Err* err);
78 bool WriteProjectFile(const BuildSettings* build_settings,
79 PBXProject* project,
80 Err* err);
81
82 void WriteWorkspaceContent(std::ostream& out);
83 void WriteProjectContent(std::ostream& out, PBXProject* project);
84
85 std::string name_;
86 std::vector<std::unique_ptr<PBXProject>> projects_;
87
88 DISALLOW_COPY_AND_ASSIGN(XcodeWriter);
89 };
90
91 #endif // TOOLS_GN_XCODE_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698