From e33ae54730d78e1c031825f0673df0adfe4d8a12 Mon Sep 17 00:00:00 2001 From: Joe Carroll Date: Sun, 28 Aug 2011 14:55:00 -0500 Subject: [PATCH 1/2] resolving build path issues, changed from Current Mac OS to Latest Mac OS X --- mogenerator.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mogenerator.xcodeproj/project.pbxproj b/mogenerator.xcodeproj/project.pbxproj index 051c6250..dda65312 100644 --- a/mogenerator.xcodeproj/project.pbxproj +++ b/mogenerator.xcodeproj/project.pbxproj @@ -486,6 +486,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(NATIVE_ARCH_ACTUAL)"; + SDKROOT = macosx; }; name = Debug; }; @@ -493,6 +494,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + SDKROOT = macosx; }; name = Release; }; From ce63e117b326461a050c47bc203f2fd6b3872cb8 Mon Sep 17 00:00:00 2001 From: Joe Carroll Date: Sun, 28 Aug 2011 15:30:25 -0500 Subject: [PATCH 2/2] adding a base-class-force option that will use user provided base class even if a super entity exists. Base-class will still function normally --- mogenerator.h | 1 + mogenerator.m | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mogenerator.h b/mogenerator.h index 79d422dd..ded88b2d 100644 --- a/mogenerator.h +++ b/mogenerator.h @@ -53,6 +53,7 @@ NSString *tempMOMPath; NSManagedObjectModel *model; NSString *baseClass; + NSString *baseClassForce; NSString *includem; NSString *includeh; NSString *templatePath; diff --git a/mogenerator.m b/mogenerator.m index d15ad152..ae7c2ddb 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -10,6 +10,7 @@ static NSString *kTemplateVar = @"TemplateVar"; NSString *gCustomBaseClass; +NSString *gCustomBaseClassForced; @interface NSEntityDescription (fetchedPropertiesAdditions) - (NSDictionary *)fetchedPropertiesByName; @@ -66,11 +67,15 @@ - (BOOL)hasCustomSuperentity { } } - (NSString*)customSuperentity { - NSEntityDescription *superentity = [self superentity]; - if (superentity) { - return [superentity managedObjectClassName]; + if(!gCustomBaseClassForced) { + NSEntityDescription *superentity = [self superentity]; + if (superentity) { + return [superentity managedObjectClassName]; + } else { + return gCustomBaseClass ? gCustomBaseClass : @"NSManagedObject"; + } } else { - return gCustomBaseClass ? gCustomBaseClass : @"NSManagedObject"; + return gCustomBaseClassForced; } } /** @TypeInfo NSAttributeDescription */ @@ -361,6 +366,7 @@ - (void) application: (DDCliApplication *) app // Long Short Argument options {@"model", 'm', DDGetoptRequiredArgument}, {@"base-class", 0, DDGetoptRequiredArgument}, + {@"base-class-force", 0, DDGetoptRequiredArgument}, // For compatibility: {@"baseClass", 0, DDGetoptRequiredArgument}, {@"includem", 0, DDGetoptRequiredArgument}, @@ -389,6 +395,7 @@ - (void) printUsage; printf("\n" " -m, --model MODEL Path to model\n" " --base-class CLASS Custom base class\n" + " --base-class-force CLASS Same as --base-class except will force all entities to have the specified base class. Even if a super entity exists\n" " --includem FILE Generate aggregate include file for .m files for both human and machine generated source files\n" " --includeh FILE Generate aggregate include file for .h files for human generated source files only\n" " --template-path PATH Path to templates (absolute or relative to model path)\n" @@ -531,8 +538,14 @@ - (int) application: (DDCliApplication *) app printf("mogenerator 1.23. By Jonathan 'Wolf' Rentzsch + friends.\n"); return EXIT_SUCCESS; } - - gCustomBaseClass = [baseClass retain]; + + if(baseClassForce) { + gCustomBaseClassForced = [baseClassForce retain]; + gCustomBaseClass = gCustomBaseClassForced; + } else { + gCustomBaseClass = [baseClass retain]; + } + NSString * mfilePath = includem; NSString * hfilePath = includeh;