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

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: 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 <string>
11 #include <vector>
12
13 #include "base/macros.h"
14
15 class Builder;
16 class BuildSettings;
17 class Err;
18 class SourceDir;
19 class Target;
20
21 using PBXAttributes = std::map<std::string, std::string>;
22 class PBXProject;
23
24 class XcodeWriter {
25 public:
26 enum TargetOsType {
27 WRITER_TARGET_OS_IOS,
28 WRITER_TARGET_OS_MACOS,
29 };
30
31 // Writes Xcode workspace and project files.
32 //
33 // |workspace_name| is the optional name of the workspace file name ("all"
34 // is used if not specified). |root_target_name| is the name of the main
35 // target corresponding to building "All" (for example "gn_all" in Chromium).
36 // |ninja_extra_args| are additional arguments to pass to ninja invocation
37 // (can be used to increase limit of concurrent processes when using goma).
38 // |target_filter_pattern| is a regular expression used to filter the targets
39 // to generate. If not set, all targets are present in the generated project.
40 //
41 // On failure will populate |err| and return false.
42 static bool RunAndWriteFiles(const std::string& workspace_name,
43 const std::string& root_target_name,
44 const std::string& ninja_extra_args,
45 const std::string& target_filter_pattern,
46 const BuildSettings* build_settings,
47 Builder* builder,
48 Err* err);
49
50 private:
51 XcodeWriter(const std::string& name);
52 ~XcodeWriter();
53
54 static std::vector<const Target*> FilterTargets(
55 const std::vector<const Target*>& all_targets,
56 const std::string& target_filter_pattern);
57
58 void CreateMainProject(const std::vector<const Target*>& targets,
59 const PBXAttributes& attributes,
60 const std::string& project_name,
61 const std::string& source_path,
62 const std::string& config_name,
63 const std::string& root_target,
64 const std::string& ninja_extra_args,
65 const std::string& target_filter_pattern,
66 TargetOsType target_os);
67
68 void CreateSourceForIndexingProject(const std::vector<const Target*>& targets,
69 const SourceDir& root_build_dir,
70 const PBXAttributes& attributes,
71 const std::string& project_name,
72 const std::string& source_path,
73 const std::string& config_name,
74 TargetOsType target_os);
75
76 bool WriteFiles(const BuildSettings* build_settings, Err* err);
77 bool WriteProjectFile(const BuildSettings* build_settings,
78 PBXProject* project,
79 Err* err);
80
81 void WriteWorkspaceContent(std::ostream& out);
82 void WriteProjectContent(std::ostream& out, PBXProject* project);
83
84 std::string name_;
85 std::vector<std::unique_ptr<PBXProject>> projects_;
86
87 DISALLOW_COPY_AND_ASSIGN(XcodeWriter);
88 };
89
90 #endif // TOOLS_GN_XCODE_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698