@@ -207,6 +207,30 @@ - (BOOL) copyResourceFrom: (NSString *)srcPath to: (NSString *)dstPath
207207 return result;
208208}
209209
210+ - (NSMutableDictionary *) configToInfoPlist : (XCBuildConfiguration *)config
211+ {
212+ NSMutableDictionary *ipd = [NSMutableDictionary dictionary ];
213+ NSDictionary *buildSettings = [config buildSettings ];
214+ // NSString *appIcon = [buildSettings objectForKey: @"ASSETCATALOG_COMPILER_APPICON_NAME"];
215+ NSString *version = [buildSettings objectForKey: @" CURRENT_PROJECT_VERSION" ];
216+ NSString *copyright = [buildSettings objectForKey: @" INFOPLIST_KEY_NSHumanReadableCopyright" ];
217+ NSString *mainNib = [buildSettings objectForKey: @" INFOPLIST_KEY_NSMainNibFile" ];
218+ NSString *principalClass = [buildSettings objectForKey: @" INFOPLIST_KEY_NSPrincipalClass" ];
219+ NSString *bundleIdentifier = [buildSettings objectForKey: @" PRODUCT_BUNDLE_IDENTIFIER" ];
220+ NSString *iconFile = [self processAssets ];
221+
222+ [ipd setObject: version forKey: @" CFBundleVersion" ];
223+ [ipd setObject: mainNib forKey: @" NSMainNibFile" ];
224+ [ipd setObject: copyright forKey: @" NSHumanReadableCopyright" ];
225+ [ipd setObject: principalClass forKey: @" NSPrincipalClass" ];
226+ [ipd setObject: iconFile forKey: @" NSIcon" ];
227+ [ipd setObject: @" $(DEVELOPMENT_LANGUAGE)" forKey: @" CFBundleDevelopmentRegion" ];
228+ [ipd setObject: @" $(EXECUTABLE_NAME)" forKey: @" CFBundlExecutable" ];
229+ [ipd setObject: bundleIdentifier forKey: @" CFBundleIdentifier" ];
230+
231+ return ipd;
232+ }
233+
210234- (BOOL ) build
211235{
212236 xcputs (" === Executing Resources Build Phase" );
@@ -332,16 +356,29 @@ - (BOOL) build
332356 XCBuildConfiguration *xbc = [xcl defaultConfiguration ];
333357 NSDictionary *bs = [xbc buildSettings ];
334358 NSString *infoPlist = [bs objectForKey: @" INFOPLIST_FILE" ];
359+ NSString *outputPlist = [resourcesDir
360+ stringByAppendingPathComponent: @" Info-gnustep.plist" ];
335361
336- if ([mgr fileExistsAtPath: infoPlist] == NO )
362+ if (infoPlist != nil )
337363 {
338- infoPlist = [infoPlist lastPathComponent ];
339- }
364+ if ([mgr fileExistsAtPath: infoPlist] == NO )
365+ {
366+ infoPlist = [infoPlist lastPathComponent ];
367+ }
340368
341- NSString *outputPlist = [resourcesDir
342- stringByAppendingPathComponent: @" Info-gnustep.plist" ];
343- [self processInfoPlistInput: infoPlist
344- output: outputPlist];
369+ [self processInfoPlistInput: infoPlist
370+ output: outputPlist];
371+ }
372+ else
373+ {
374+ xcputs ([[NSString stringWithFormat: @" \t * No Info.plist, generating..." ] cString ]);
375+ XCBuildConfiguration *config = [xcl configurationWithName: @" Debug" ];
376+ NSMutableDictionary *ipl = [self configToInfoPlist: config];
377+ NSString *plString = [ipl description ];
378+
379+ NSDebugLog (@" ipl = %@ " , ipl);
380+ [plString writeToFile: outputPlist atomically: YES ];
381+ }
345382
346383 xcputs (" === Resources Build Phase Completed" );
347384 fflush (stdout);
0 commit comments