-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathXCProject.h
225 lines (177 loc) · 6.02 KB
/
XCProject.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
////////////////////////////////////////////////////////////////////////////////
//
// JASPER BLUES
// Copyright 2012 - 2013 Jasper Blues
// All Rights Reserved.
//
// NOTICE: Jasper Blues permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <XcodeEditor/XcodeMemberType.h>
#import <XcodeEditor/XcodeSourceFileType.h>
#import <XcodeEditor/XcodeGroupMember.h>
@class XCClassDefinition;
@class XCGroup;
@class XCFileOperationQueue;
@class XCSourceFile;
@class XCTarget;
@class XCSubProjectDefinition;
@class XCProjectBuildConfig;
@class XCVersionGroup;
@interface XCProject : NSObject
{
@protected
XCFileOperationQueue* _fileOperationQueue;
NSString* _filePath;
NSMutableDictionary* _dataStore;
NSMutableArray* _targets;
NSMutableDictionary* _groups;
NSMutableDictionary* _versionGroups;
NSMutableDictionary* _configurations;
NSString* _defaultConfigurationName;
NSString* _rootObjectKey;
}
@property(nonatomic, strong, readonly) XCFileOperationQueue* fileOperationQueue;
//-------------------------------------------------------------------------------------------
#pragma mark - Initialization & Destruction
//-------------------------------------------------------------------------------------------
+ (XCProject*)projectWithFilePath:(NSString*)filePath;
/**
* Creates a new project editor instance with the specified Project.xcodeproj file.
*/
- (id)initWithFilePath:(NSString*)filePath;
//-------------------------------------------------------------------------------------------
#pragma mark Groupd Member
- (id<XcodeGroupMember>)groupMemberWithKey:(NSString *)key;
//-------------------------------------------------------------------------------------------
#pragma mark Files
/**
* Returns all file resources in the project, as an array of `XCSourceFile` objects.
*/
- (NSArray<XCSourceFile*>*)files;
/**
* Returns the project file with the specified key, or nil.
*/
- (XCSourceFile*)fileWithKey:(NSString*)key;
/**
* Returns the project file with the specified name, or nil. If more than one project file matches the specified name,
* which one is returned is undefined.
*/
- (XCSourceFile*)fileWithName:(NSString*)name;
/**
* Returns all header files in the project, as an array of `XCSourceFile` objects.
*/
- (NSArray<XCSourceFile*>*)headerFiles;
/**
* Returns all implementation obj-c implementation files in the project, as an array of `XCSourceFile` objects.
*/
- (NSArray<XCSourceFile*>*)objectiveCFiles;
/**
* Returns all implementation obj-c++ implementation files in the project, as an array of `XCSourceFile` objects.
*/
- (NSArray<XCSourceFile*>*)objectiveCPlusPlusFiles;
/**
* Returns all the xib files in the project, as an array of `XCSourceFile` objects.
*/
- (NSArray<XCSourceFile*>*)xibFiles;
- (NSArray<XCSourceFile*>*)imagePNGFiles;
- (NSString*)filePath;
//-------------------------------------------------------------------------------------------
#pragma mark Groups
/**
* Lists the groups in an xcode project, returning an array of `XCGroup` objects.
*/
- (NSArray<XCGroup*>*)groups;
/**
* Returns the root (top-level) _group.
*/
- (XCGroup*)rootGroup;
/**
* Returns the root (top-level) groups, if there are multiple. An array of rootGroup if there is only one.
*/
- (NSArray<XCGroup*>*)rootGroups;
/**
* Returns the main group under root object
*/
- (XCGroup *)mainGroup;
/**
* Returns the group with the given key, or nil.
*/
- (XCGroup*)groupWithKey:(NSString*)key;
/**
* Returns the _first_ group in the project with the given name, or nil.
*/
- (XCGroup*)groupWithDisplayName:(NSString*)name;
/**
* Returns the _group with the specified display name path - the directory relative to the root _group. Eg Source/Main
*/
- (XCGroup*)groupWithPathFromRoot:(NSString*)path;
/**
* Returns the parent _group for the _group or file with the given key;
*/
- (XCGroup*)groupForGroupMemberWithKey:(NSString*)key;
/**
* Returns the parent group for the group or file with the source file
*/
- (XCGroup*)groupWithSourceFile:(XCSourceFile*)sourceFile;
/**
* Removes all empty groups from the project.
*/
- (void)pruneEmptyGroups;
//-------------------------------------------------------------------------------------------
#pragma mark VersionGroups
/**
* Lists the version groups in an xcode project, returning an array of `XCVersionGroup` objects.
*/
- (NSArray*)versionGroups;
/**
* Returns the version group with the given key, or nil.
*/
- (XCVersionGroup*)versionGroupWithKey:(NSString*)key;
/**
* Returns the version group with the given file name, or nil.
*/
- (XCVersionGroup*)versionGroupWithName:(NSString*)name;
//-------------------------------------------------------------------------------------------
#pragma mark Targets
/**
* Lists the targets in an xcode project, returning an array of `XCTarget` objects.
*/
- (NSArray<XCTarget*>*)targets;
/**
* Returns the target with the specified name, or nil.
*/
- (XCTarget*)targetWithName:(NSString*)name;
/**
* Lists the targets which are of application type.
*/
- (NSArray*)applicationTargets;
#pragma mark Configurations
/**
* Lists the configurations in an xcode project.
*/
- (NSDictionary<NSString*,XCProjectBuildConfig*>*)configurations;
/**
* Returns the configuration with the specified name, or nil.
*/
- (XCProjectBuildConfig*)configurationWithName:(NSString*)name;
- (XCProjectBuildConfig *)defaultConfiguration;
//-------------------------------------------------------------------------------------------
#pragma mark Deletion
- (void)removeObjectWithKey:(NSString*)key;
//-------------------------------------------------------------------------------------------
#pragma mark Saving
/**
* Saves a project after editing.
*/
- (void)save;
//-------------------------------------------------------------------------------------------
/**
* Raw project data.
*/
- (NSMutableDictionary*)objects;
- (NSMutableDictionary*)dataStore;
- (void)dropCache;
@end