@@ -56,7 +56,7 @@ - (NSString *)presentationNameForKey:(NSString *)key {
5656
5757 NSString *processedKey = [key tps_baseBuildSettingName ]; // strip any conditional part of build setting
5858
59- processedKey = [NSString stringWithFormat: @" [ %@ ]-name " , processedKey];
59+ processedKey = [self displayNameKeyForSetting: processedKey];
6060 return self.buildSettingInfoDictionary [processedKey];
6161}
6262
@@ -67,7 +67,7 @@ - (NSString *)descriptionForKey:(NSString *)key {
6767
6868 NSString *processedKey = [key tps_baseBuildSettingName ]; // strip any conditional part of build setting
6969
70- processedKey = [NSString stringWithFormat: @" [ %@ ]-description " , processedKey];
70+ processedKey = [self descriptionKeyForSetting: processedKey];
7171 return self.buildSettingInfoDictionary [processedKey];
7272}
7373
@@ -144,9 +144,17 @@ - (void)loadBuildSettingInfo {
144144 for (NSArray *buildSettingInfoSubpathList in buildSettingInfoSubpaths) {
145145 BOOL foundOne = NO ;
146146 for (NSString *subpath in buildSettingInfoSubpathList) {
147+ NSString *pathExtension = [subpath pathExtension ];
147148 NSString *fullpath = [defaultXcodePath stringByAppendingPathComponent: subpath];
148- NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile: fullpath];
149- [infoStringFile addEntriesFromDictionary: dictionary];
149+ NSDictionary *dictionary = nil ;
150+ if ([pathExtension isEqualToString: @" strings" ]) {
151+ dictionary = [NSDictionary dictionaryWithContentsOfFile: fullpath];
152+ } else if ([pathExtension isEqualToString: @" xcspec" ]) {
153+ dictionary = [self xcspecFileBuildSettingInfoForPath: fullpath];
154+ }
155+ if (dictionary) {
156+ [infoStringFile addEntriesFromDictionary: dictionary];
157+ }
150158 if (dictionary || foundOne) {
151159 foundOne = YES ;
152160 }
@@ -165,5 +173,52 @@ - (void)loadBuildSettingInfo {
165173 _buildSettingInfoDictionary = infoStringFile;
166174}
167175
176+ - (NSDictionary *)xcspecFileBuildSettingInfoForPath : (NSString *)path {
177+ NSURL *fileURL = [NSURL fileURLWithPath: path];
178+ NSMutableDictionary *buildSettingInfo = [NSMutableDictionary dictionary ];
179+ NSError *error = nil ;
180+ NSData *plistData = [[NSData alloc ] initWithContentsOfURL: fileURL];
181+ id plist = [NSPropertyListSerialization propertyListWithData: plistData options: NSPropertyListImmutable format: nil error: &error];
182+ if ([plist isKindOfClass: [NSArray class ]]) {
183+ NSArray *specs = (NSArray *)plist;
184+ for (id spec in specs) {
185+ if ([spec isKindOfClass: [NSDictionary class ]]) {
186+ NSDictionary *specDict = (NSDictionary *)spec;
187+ NSString *specType = specDict[@" Type" ];
188+ if ([specType isEqualToString: @" BuildSystem" ]) {
189+
190+ id options = specDict[@" Options" ];
191+ if (!options) options = specDict[@" Properties" ];
192+
193+ if ([options isKindOfClass: [NSArray class ]]) {
194+ for (id option in options) {
195+ if ([option isKindOfClass: [NSDictionary class ]]) {
196+ NSString *name = option[@" Name" ];
197+ NSString *desc = option[@" Description" ];
198+ NSString *displayName = option[@" DisplayName" ];
199+
200+ if (name && desc && displayName) {
201+ [buildSettingInfo setValue: displayName forKey: [self displayNameKeyForSetting: name]];
202+ [buildSettingInfo setValue: desc forKey: [self descriptionKeyForSetting: name]];
203+ }
204+ }
205+ }
206+ }
207+ }
208+
209+ }
210+ }
211+ }
212+
213+ return buildSettingInfo;
214+ }
215+
216+ - (NSString *)displayNameKeyForSetting : (NSString *)settingName {
217+ return [NSString stringWithFormat: @" [%@ ]-name" , settingName];
218+ }
219+
220+ - (NSString *)descriptionKeyForSetting : (NSString *)settingName {
221+ return [NSString stringWithFormat: @" [%@ ]-description" , settingName];
222+ }
168223
169224@end
0 commit comments