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_WRITER_H_ | 5 #ifndef TOOLS_GN_XCODE_WRITER_H_ |
6 #define TOOLS_GN_XCODE_WRITER_H_ | 6 #define TOOLS_GN_XCODE_WRITER_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 | 15 |
16 class Builder; | 16 class Builder; |
17 class BuildSettings; | 17 class BuildSettings; |
18 class Err; | 18 class Err; |
19 class SourceDir; | |
20 class Target; | 19 class Target; |
21 | 20 |
22 using PBXAttributes = std::map<std::string, std::string>; | 21 using PBXAttributes = std::map<std::string, std::string>; |
23 class PBXProject; | 22 class PBXProject; |
24 | 23 |
25 class XcodeWriter { | 24 class XcodeWriter { |
26 public: | 25 public: |
27 enum TargetOsType { | 26 enum TargetOsType { |
28 WRITER_TARGET_OS_IOS, | 27 WRITER_TARGET_OS_IOS, |
29 WRITER_TARGET_OS_MACOS, | 28 WRITER_TARGET_OS_MACOS, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 61 |
63 // Filters list of targets to only return ones that are xctest module bundles. | 62 // Filters list of targets to only return ones that are xctest module bundles. |
64 static void FilterXCTestModuleTargets( | 63 static void FilterXCTestModuleTargets( |
65 const std::vector<const Target*>& targets, | 64 const std::vector<const Target*>& targets, |
66 std::vector<const Target*>* xctest_module_targets); | 65 std::vector<const Target*>* xctest_module_targets); |
67 | 66 |
68 // Generate the "products.xcodeproj" project that reference all products | 67 // Generate the "products.xcodeproj" project that reference all products |
69 // (i.e. targets that have a build artefact usable from Xcode, mostly | 68 // (i.e. targets that have a build artefact usable from Xcode, mostly |
70 // application bundles). | 69 // application bundles). |
71 void CreateProductsProject(const std::vector<const Target*>& targets, | 70 void CreateProductsProject(const std::vector<const Target*>& targets, |
| 71 const std::vector<const Target*>& all_targets, |
72 const PBXAttributes& attributes, | 72 const PBXAttributes& attributes, |
73 const std::string& source_path, | 73 const std::string& source_path, |
74 const std::string& config_name, | 74 const std::string& config_name, |
75 const std::string& root_target, | 75 const std::string& root_target, |
76 const std::string& ninja_extra_args, | 76 const std::string& ninja_extra_args, |
77 const BuildSettings* build_settings, | 77 const BuildSettings* build_settings, |
78 TargetOsType target_os); | 78 TargetOsType target_os); |
79 | 79 |
80 // Generates the "sources.xcodeproj" project that reference all source | |
81 // files to allow Xcode to index them. | |
82 void CreateSourcesProject(const std::vector<const Target*>& targets, | |
83 const SourceDir& root_build_dir, | |
84 const PBXAttributes& attributes, | |
85 const std::string& source_path, | |
86 const std::string& absolute_source_path, | |
87 const std::string& config_name, | |
88 TargetOsType target_os); | |
89 | |
90 bool WriteFiles(const BuildSettings* build_settings, Err* err); | 80 bool WriteFiles(const BuildSettings* build_settings, Err* err); |
91 bool WriteProjectFile(const BuildSettings* build_settings, | 81 bool WriteProjectFile(const BuildSettings* build_settings, |
92 PBXProject* project, | 82 PBXProject* project, |
93 Err* err); | 83 Err* err); |
94 | 84 |
95 void WriteWorkspaceContent(std::ostream& out); | 85 void WriteWorkspaceContent(std::ostream& out); |
96 void WriteProjectContent(std::ostream& out, PBXProject* project); | 86 void WriteProjectContent(std::ostream& out, PBXProject* project); |
97 | 87 |
98 std::string name_; | 88 std::string name_; |
99 std::vector<std::unique_ptr<PBXProject>> projects_; | 89 std::vector<std::unique_ptr<PBXProject>> projects_; |
100 | 90 |
101 DISALLOW_COPY_AND_ASSIGN(XcodeWriter); | 91 DISALLOW_COPY_AND_ASSIGN(XcodeWriter); |
102 }; | 92 }; |
103 | 93 |
104 #endif // TOOLS_GN_XCODE_WRITER_H_ | 94 #endif // TOOLS_GN_XCODE_WRITER_H_ |
OLD | NEW |