OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef TOOLS_GN_XCODE_OBJECT_H_ | 5 #ifndef TOOLS_GN_XCODE_OBJECT_H_ |
6 #define TOOLS_GN_XCODE_OBJECT_H_ | 6 #define TOOLS_GN_XCODE_OBJECT_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 15 matching lines...) Expand all Loading... |
26 NONE, | 26 NONE, |
27 HELP, | 27 HELP, |
28 }; | 28 }; |
29 | 29 |
30 // PBXObjectClass ------------------------------------------------------------- | 30 // PBXObjectClass ------------------------------------------------------------- |
31 | 31 |
32 enum PBXObjectClass { | 32 enum PBXObjectClass { |
33 // Those values needs to stay sorted in alphabetic order. | 33 // Those values needs to stay sorted in alphabetic order. |
34 PBXAggregateTargetClass, | 34 PBXAggregateTargetClass, |
35 PBXBuildFileClass, | 35 PBXBuildFileClass, |
| 36 PBXContainerItemProxyClass, |
36 PBXFileReferenceClass, | 37 PBXFileReferenceClass, |
37 PBXFrameworksBuildPhaseClass, | 38 PBXFrameworksBuildPhaseClass, |
38 PBXGroupClass, | 39 PBXGroupClass, |
39 PBXNativeTargetClass, | 40 PBXNativeTargetClass, |
40 PBXProjectClass, | 41 PBXProjectClass, |
41 PBXShellScriptBuildPhaseClass, | 42 PBXShellScriptBuildPhaseClass, |
42 PBXSourcesBuildPhaseClass, | 43 PBXSourcesBuildPhaseClass, |
| 44 PBXTargetDependencyClass, |
43 XCBuildConfigurationClass, | 45 XCBuildConfigurationClass, |
44 XCConfigurationListClass, | 46 XCConfigurationListClass, |
45 }; | 47 }; |
46 | 48 |
47 const char* ToString(PBXObjectClass cls); | 49 const char* ToString(PBXObjectClass cls); |
48 | 50 |
49 // Forward-declarations ------------------------------------------------------- | 51 // Forward-declarations ------------------------------------------------------- |
50 | 52 |
51 class PBXAggregateTarget; | 53 class PBXAggregateTarget; |
52 class PBXBuildFile; | 54 class PBXBuildFile; |
| 55 class PBXBuildPhase; |
| 56 class PBXContainerItemProxy; |
53 class PBXFileReference; | 57 class PBXFileReference; |
54 class PBXBuildPhase; | |
55 class PBXFrameworksBuildPhase; | 58 class PBXFrameworksBuildPhase; |
56 class PBXGroup; | 59 class PBXGroup; |
57 class PBXNativeTarget; | 60 class PBXNativeTarget; |
58 class PBXObject; | 61 class PBXObject; |
59 class PBXProject; | 62 class PBXProject; |
60 class PBXShellScriptBuildPhase; | 63 class PBXShellScriptBuildPhase; |
61 class PBXSourcesBuildPhase; | 64 class PBXSourcesBuildPhase; |
62 class PBXTarget; | 65 class PBXTarget; |
| 66 class PBXTargetDependency; |
63 class XCBuildConfiguration; | 67 class XCBuildConfiguration; |
64 class XCConfigurationList; | 68 class XCConfigurationList; |
65 | 69 |
66 using PBXAttributes = std::map<std::string, std::string>; | 70 using PBXAttributes = std::map<std::string, std::string>; |
67 | 71 |
68 // PBXObjectVisitor ----------------------------------------------------------- | 72 // PBXObjectVisitor ----------------------------------------------------------- |
69 | 73 |
70 class PBXObjectVisitor { | 74 class PBXObjectVisitor { |
71 public: | 75 public: |
72 PBXObjectVisitor(); | 76 PBXObjectVisitor(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // PBXTarget ------------------------------------------------------------------ | 119 // PBXTarget ------------------------------------------------------------------ |
116 | 120 |
117 class PBXTarget : public PBXObject { | 121 class PBXTarget : public PBXObject { |
118 public: | 122 public: |
119 PBXTarget(const std::string& name, | 123 PBXTarget(const std::string& name, |
120 const std::string& shell_script, | 124 const std::string& shell_script, |
121 const std::string& config_name, | 125 const std::string& config_name, |
122 const PBXAttributes& attributes); | 126 const PBXAttributes& attributes); |
123 ~PBXTarget() override; | 127 ~PBXTarget() override; |
124 | 128 |
125 // PXBObject implementation. | 129 void AddDependency(std::unique_ptr<PBXTargetDependency> dependency); |
| 130 |
| 131 // PBXObject implementation. |
126 std::string Name() const override; | 132 std::string Name() const override; |
127 void Visit(PBXObjectVisitor& visitor) override; | 133 void Visit(PBXObjectVisitor& visitor) override; |
128 | 134 |
129 protected: | 135 protected: |
130 std::unique_ptr<XCConfigurationList> configurations_; | 136 std::unique_ptr<XCConfigurationList> configurations_; |
131 std::vector<std::unique_ptr<PBXBuildPhase>> build_phases_; | 137 std::vector<std::unique_ptr<PBXBuildPhase>> build_phases_; |
| 138 std::vector<std::unique_ptr<PBXTargetDependency>> dependencies_; |
132 PBXSourcesBuildPhase* source_build_phase_; | 139 PBXSourcesBuildPhase* source_build_phase_; |
133 std::string name_; | 140 std::string name_; |
134 | 141 |
135 private: | 142 private: |
136 DISALLOW_COPY_AND_ASSIGN(PBXTarget); | 143 DISALLOW_COPY_AND_ASSIGN(PBXTarget); |
137 }; | 144 }; |
138 | 145 |
139 // PBXAggregateTarget --------------------------------------------------------- | 146 // PBXAggregateTarget --------------------------------------------------------- |
140 | 147 |
141 class PBXAggregateTarget : public PBXTarget { | 148 class PBXAggregateTarget : public PBXTarget { |
142 public: | 149 public: |
143 PBXAggregateTarget(const std::string& name, | 150 PBXAggregateTarget(const std::string& name, |
144 const std::string& shell_script, | 151 const std::string& shell_script, |
145 const std::string& config_name, | 152 const std::string& config_name, |
146 const PBXAttributes& attributes); | 153 const PBXAttributes& attributes); |
147 ~PBXAggregateTarget() override; | 154 ~PBXAggregateTarget() override; |
148 | 155 |
149 // PXBObject implementation. | 156 // PBXObject implementation. |
150 PBXObjectClass Class() const override; | 157 PBXObjectClass Class() const override; |
151 void Print(std::ostream& out, unsigned indent) const override; | 158 void Print(std::ostream& out, unsigned indent) const override; |
152 | 159 |
153 private: | 160 private: |
154 DISALLOW_COPY_AND_ASSIGN(PBXAggregateTarget); | 161 DISALLOW_COPY_AND_ASSIGN(PBXAggregateTarget); |
155 }; | 162 }; |
156 | 163 |
157 // PBXBuildFile --------------------------------------------------------------- | 164 // PBXBuildFile --------------------------------------------------------------- |
158 | 165 |
159 class PBXBuildFile : public PBXObject { | 166 class PBXBuildFile : public PBXObject { |
160 public: | 167 public: |
161 PBXBuildFile(const PBXFileReference* file_reference, | 168 PBXBuildFile(const PBXFileReference* file_reference, |
162 const PBXSourcesBuildPhase* build_phase, | 169 const PBXSourcesBuildPhase* build_phase, |
163 const CompilerFlags compiler_flag); | 170 const CompilerFlags compiler_flag); |
164 ~PBXBuildFile() override; | 171 ~PBXBuildFile() override; |
165 | 172 |
166 // PXBObject implementation. | 173 // PBXObject implementation. |
167 PBXObjectClass Class() const override; | 174 PBXObjectClass Class() const override; |
168 std::string Name() const override; | 175 std::string Name() const override; |
169 void Print(std::ostream& out, unsigned indent) const override; | 176 void Print(std::ostream& out, unsigned indent) const override; |
170 | 177 |
171 private: | 178 private: |
172 const PBXFileReference* file_reference_; | 179 const PBXFileReference* file_reference_; |
173 const PBXSourcesBuildPhase* build_phase_; | 180 const PBXSourcesBuildPhase* build_phase_; |
174 const CompilerFlags compiler_flag_; | 181 const CompilerFlags compiler_flag_; |
175 | 182 |
176 DISALLOW_COPY_AND_ASSIGN(PBXBuildFile); | 183 DISALLOW_COPY_AND_ASSIGN(PBXBuildFile); |
177 }; | 184 }; |
178 | 185 |
| 186 // PBXContainerItemProxy ------------------------------------------------------ |
| 187 class PBXContainerItemProxy : public PBXObject { |
| 188 public: |
| 189 PBXContainerItemProxy(const PBXProject* project, const PBXTarget* target); |
| 190 ~PBXContainerItemProxy() override; |
| 191 |
| 192 // PBXObject implementation. |
| 193 PBXObjectClass Class() const override; |
| 194 std::string Name() const override; |
| 195 void Visit(PBXObjectVisitor& visitor) override; |
| 196 void Print(std::ostream& out, unsigned indent) const override; |
| 197 |
| 198 private: |
| 199 const PBXProject* project_; |
| 200 const PBXTarget* target_; |
| 201 |
| 202 DISALLOW_COPY_AND_ASSIGN(PBXContainerItemProxy); |
| 203 }; |
| 204 |
179 // PBXFileReference ----------------------------------------------------------- | 205 // PBXFileReference ----------------------------------------------------------- |
180 | 206 |
181 class PBXFileReference : public PBXObject { | 207 class PBXFileReference : public PBXObject { |
182 public: | 208 public: |
183 PBXFileReference(const std::string& name, | 209 PBXFileReference(const std::string& name, |
184 const std::string& path, | 210 const std::string& path, |
185 const std::string& type); | 211 const std::string& type); |
186 ~PBXFileReference() override; | 212 ~PBXFileReference() override; |
187 | 213 |
188 // PBXObject implementation. | 214 // PBXObject implementation. |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 std::string Name() const override; | 391 std::string Name() const override; |
366 void Visit(PBXObjectVisitor& visitor) override; | 392 void Visit(PBXObjectVisitor& visitor) override; |
367 void Print(std::ostream& out, unsigned indent) const override; | 393 void Print(std::ostream& out, unsigned indent) const override; |
368 | 394 |
369 private: | 395 private: |
370 std::vector<std::unique_ptr<PBXBuildFile>> files_; | 396 std::vector<std::unique_ptr<PBXBuildFile>> files_; |
371 | 397 |
372 DISALLOW_COPY_AND_ASSIGN(PBXSourcesBuildPhase); | 398 DISALLOW_COPY_AND_ASSIGN(PBXSourcesBuildPhase); |
373 }; | 399 }; |
374 | 400 |
| 401 // PBXTargetDependency ----------------------------------------------------- |
| 402 class PBXTargetDependency : public PBXObject { |
| 403 public: |
| 404 PBXTargetDependency( |
| 405 const PBXTarget* target, |
| 406 std::unique_ptr<PBXContainerItemProxy> container_item_proxy); |
| 407 ~PBXTargetDependency() override; |
| 408 |
| 409 // PBXObject implementation. |
| 410 PBXObjectClass Class() const override; |
| 411 std::string Name() const override; |
| 412 void Visit(PBXObjectVisitor& visitor) override; |
| 413 void Print(std::ostream& out, unsigned indent) const override; |
| 414 |
| 415 private: |
| 416 const PBXTarget* target_; |
| 417 std::unique_ptr<PBXContainerItemProxy> container_item_proxy_; |
| 418 |
| 419 DISALLOW_COPY_AND_ASSIGN(PBXTargetDependency); |
| 420 }; |
| 421 |
375 // XCBuildConfiguration ------------------------------------------------------- | 422 // XCBuildConfiguration ------------------------------------------------------- |
376 | 423 |
377 class XCBuildConfiguration : public PBXObject { | 424 class XCBuildConfiguration : public PBXObject { |
378 public: | 425 public: |
379 XCBuildConfiguration(const std::string& name, | 426 XCBuildConfiguration(const std::string& name, |
380 const PBXAttributes& attributes); | 427 const PBXAttributes& attributes); |
381 ~XCBuildConfiguration() override; | 428 ~XCBuildConfiguration() override; |
382 | 429 |
383 // PBXObject implementation. | 430 // PBXObject implementation. |
384 PBXObjectClass Class() const override; | 431 PBXObjectClass Class() const override; |
(...skipping 23 matching lines...) Expand all Loading... |
408 void Print(std::ostream& out, unsigned indent) const override; | 455 void Print(std::ostream& out, unsigned indent) const override; |
409 | 456 |
410 private: | 457 private: |
411 std::vector<std::unique_ptr<XCBuildConfiguration>> configurations_; | 458 std::vector<std::unique_ptr<XCBuildConfiguration>> configurations_; |
412 const PBXObject* owner_reference_; | 459 const PBXObject* owner_reference_; |
413 | 460 |
414 DISALLOW_COPY_AND_ASSIGN(XCConfigurationList); | 461 DISALLOW_COPY_AND_ASSIGN(XCConfigurationList); |
415 }; | 462 }; |
416 | 463 |
417 #endif // TOOLS_GN_XCODE_OBJECT_H_ | 464 #endif // TOOLS_GN_XCODE_OBJECT_H_ |
OLD | NEW |