Permalink
Browse files

Added support for the following momc options:

MOMC_NO_WARNINGS, MOMC_NO_INVERSE_RELATIONSHIP_WARNINGS, MOMC_SUPPRESS_INVERSE_TRANSIENT_ERROR

These options can be set as ENV variables and they will be passed to the momc compiler.
  • Loading branch information...
1 parent 4716a9c commit 96786d4caf78ea6988ac430191e555350ca468c5 @nikita-zhuk nikita-zhuk committed Jun 4, 2011
Showing with 13 additions and 1 deletion.
  1. +13 −1 mogenerator.m
View
@@ -426,7 +426,19 @@ - (void)setModel:(NSString*)path;
assert(momc && "momc not found");
tempMOMPath = [[NSTemporaryDirectory() stringByAppendingPathComponent:[[NSProcessInfo processInfo] globallyUniqueString]] stringByAppendingPathExtension:@"mom"];
- system([[NSString stringWithFormat:@"\"%@\" \"%@\" \"%@\"", momc, path, tempMOMPath] UTF8String]); // Ignored system's result -- momc doesn't return any relevent error codes.
+
+ NSArray *supportedMomcOptions = [NSArray arrayWithObjects:@"MOMC_NO_WARNINGS", @"MOMC_NO_INVERSE_RELATIONSHIP_WARNINGS", @"MOMC_SUPPRESS_INVERSE_TRANSIENT_ERROR", nil];
+ NSMutableString *momcOptions = [NSMutableString string];
+
+ for (NSString *momcOption in supportedMomcOptions)
+ {
+ if([[[NSProcessInfo processInfo] environment] objectForKey:momcOption] != nil)
+ {
+ [momcOptions appendFormat:@" -%@ ", momcOption];
+ }
+ }
+
+ system([[NSString stringWithFormat:@"\"%@\" %@ \"%@\" \"%@\"", momc, momcOptions, path, tempMOMPath] UTF8String]); // Ignored system's result -- momc doesn't return any relevent error codes.
path = tempMOMPath;
}
model = [[[NSManagedObjectModel alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path]] autorelease];

0 comments on commit 96786d4

Please sign in to comment.