Repository navigation
Expand file tree
/
Copy pathXCGroup.h
More file actions
executable file
·185 lines (139 loc) · 5.11 KB
/
Copy pathXCGroup.h
File metadata and controls
executable file
·185 lines (139 loc) · 5.11 KB
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
////////////////////////////////////////////////////////////////////////////////
//
// JASPER BLUES
// Copyright 2012 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 "XcodeGroupMember.h"
@class XCProject;
@class XCClassDefinition;
@class XCSourceFile;
@class XCXibDefinition;
@class XCFileOperationQueue;
@class XCFrameworkDefinition;
@class XCSourceFileDefinition;
@class XCSubProjectDefinition;
@class XCTarget;
/**
* Represents a group container in an Xcode project. A group can contain members of type `XCSourceFile` or other
* groups.
*/
@interface XCGroup : NSObject <XcodeGroupMember>
{
NSString* _pathRelativeToParent;
NSString* _key;
NSString* _alias;
@private
NSString* _pathRelativeToProjectRoot;
NSMutableArray* _children;
NSMutableArray* _members;
XCFileOperationQueue* _fileOperationQueue; // weak
XCProject* _project;
}
/**
* The alias of the group, which can be used to give the group a name other than the last path component.
*
* See: [XcodeGroupMember displayName]
*/
@property(nonatomic, strong, readonly) NSString* alias;
/**
* The path of the group relative to the group's parent.
*
* See: [XcodeGroupMember displayName]
*/
@property(nonatomic, strong, readonly) NSString* pathRelativeToParent;
/**
* The group's unique key.
*/
@property(nonatomic, strong, readonly) NSString* key;
/**
* An array containing the groups members as `XcodeGroupMember` types.
*/
@property(nonatomic, strong, readonly) NSMutableArray<id<XcodeGroupMember>>* children;
#pragma mark Initializers
+ (XCGroup*)groupWithProject:(XCProject*)project key:(NSString*)key alias:(NSString*)alias path:(NSString*)path children:(NSArray<id<XcodeGroupMember>>*)children;
- (id)initWithProject:(XCProject*)project key:(NSString*)key alias:(NSString*)alias path:(NSString*)path children:(NSArray<id<XcodeGroupMember>>*)children;
#pragma mark Parent group
- (void)removeFromParentGroup;
- (void)removeFromParentDeletingChildren:(BOOL)deleteChildren;
- (XCGroup*)parentGroup;
- (BOOL)isRootGroup;
#pragma mark Adding children
/**
* Adds a class to the group, as specified by the ClassDefinition. If the group already contains a class by the same
* name, the contents will be updated.
*/
- (void)addClass:(XCClassDefinition*)classDefinition;
/**
* Adds a class to the group, making it a member of the specified [targets](XCTarget).
*/
- (void)addClass:(XCClassDefinition*)classDefinition toTargets:(NSArray<XCTarget*>*)targets;
/**
* Adds a framework to the group. If the group already contains the framework, the contents will be updated if the
* framework definition's copyToDestination flag is yes, otherwise it will be ignored.
*/
- (void)addFramework:(XCFrameworkDefinition*)frameworkDefinition;
/**
* Adds a group with a path relative to this group.
*/
- (XCGroup*)addGroupWithPath:(NSString*)path;
/**
* Adds a reference to a folder
*/
- (void)addFolderReference:(NSString*)sourceFolder;
/**
* Adds a framework to the group, making it a member of the specified targets.
*/
- (void)addFramework:(XCFrameworkDefinition*)framework toTargets:(NSArray<XCTarget*>*)targets;
/**
* Adds a source file of arbitrary type - image resource, header, etc.
*/
- (void)addSourceFile:(XCSourceFileDefinition*)sourceFileDefinition;
/**
* Adds a xib file to the group. If the group already contains a class by the same name, the contents will be updated.
*/
- (void)addXib:(XCXibDefinition*)xibDefinition;
/**
* Adds a xib to the group, making it a member of the specified [targets](XCTarget).
*/
- (void)addXib:(XCXibDefinition*)xibDefinition toTargets:(NSArray<XCTarget*>*)targets;
/**
* Adds a sub-project to the group. If the group already contains a sub-project by the same name, the contents will be
* updated.
* Returns boolean success/fail; if method fails, caller should assume that project file is corrupt (or file format has
* changed).
*/
- (void)addSubProject:(XCSubProjectDefinition*)projectDefinition;
/**
* Adds a sub-project to the group, making it a member of the specified [targets](XCTarget).
*/
- (void)addSubProject:(XCSubProjectDefinition*)projectDefinition toTargets:(NSArray<XCTarget*>*)targets;
- (void)removeSubProject:(XCSubProjectDefinition*)projectDefinition;
- (void)removeSubProject:(XCSubProjectDefinition*)projectDefinition fromTargets:(NSArray<XCTarget*>*)targets;
#pragma mark Locating children
/**
* Instances of `XCSourceFile` and `XCGroup` returned as the type `XcodeGroupMember`.
*/
- (NSArray<id<XcodeGroupMember>>*)members;
/**
* Keys of members from this group and any child groups.
*/
- (NSArray<NSString*>*)recursiveMembers;
/**
* Keys of members from this group
*/
- (NSArray<NSString*>*)buildFileKeys;
/**
* Returns the child with the specified key, or nil.
*/
- (id <XcodeGroupMember>)memberWithKey:(NSString*)key;
/**
* Returns the child with the specified name, or nil.
*/
- (id <XcodeGroupMember>)memberWithDisplayName:(NSString*)name;
@end