File tree 4 files changed +32
-0
lines changed
4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 17
17
- (NSArray *)entitiesWithACustomSubclassInConfiguration : (NSString *)configuration_ verbose : (BOOL )verbose_ ;
18
18
@end
19
19
20
+ @interface NSEntityDescription (userInfo)
21
+ // / @return Whether or not the entity should be ignored during code generation
22
+ - (BOOL )isIgnored ;
23
+ @end
24
+
20
25
@interface NSEntityDescription (customBaseClass)
21
26
- (BOOL )hasCustomClass ;
22
27
- (BOOL )hasSuperentity ;
Original file line number Diff line number Diff line change 19
19
static const NSString *const kAdditionalImportsKey = @" additionalImports" ;
20
20
static const NSString *const kCustomBaseClass = @" mogenerator.customBaseClass" ;
21
21
static const NSString *const kReadOnly = @" mogenerator.readonly" ;
22
+ static const NSString *const kIgnored = @" mogenerator.ignore" ;
22
23
23
24
@interface NSEntityDescription (fetchedPropertiesAdditions)
24
25
- (NSDictionary *)fetchedPropertiesByName ;
@@ -135,6 +136,15 @@ - (NSArray*)entitiesWithACustomSubclassInConfiguration:(NSString*)configuration_
135
136
}
136
137
@end
137
138
139
+ @implementation NSEntityDescription (userInfo)
140
+ - (BOOL )isIgnored {
141
+ NSString *readonlyUserinfoValue = [[self userInfo ] objectForKey: kIgnored ];
142
+ if (readonlyUserinfoValue != nil ) {
143
+ return YES ;
144
+ }
145
+ return NO ;
146
+ }
147
+ @end
138
148
139
149
@implementation NSEntityDescription (customBaseClass)
140
150
- (BOOL )hasCustomBaseCaseImport {
@@ -1192,6 +1202,9 @@ - (int)application:(DDCliApplication*)app runWithArguments:(NSArray*)arguments {
1192
1202
NSArray *entitiesWithCustomSubclass = [model entitiesWithACustomSubclassInConfiguration: configuration verbose: YES ];
1193
1203
for (NSEntityDescription *entity in entitiesWithCustomSubclass)
1194
1204
{
1205
+ if ([entity isIgnored ]) {
1206
+ continue ;
1207
+ }
1195
1208
NSString *generatedMachineH = [machineH executeWithObject: entity sender: nil ];
1196
1209
NSString *generatedMachineM = [machineM executeWithObject: entity sender: nil ];
1197
1210
NSString *generatedHumanH = [humanH executeWithObject: entity sender: nil ];
Original file line number Diff line number Diff line change @@ -45,18 +45,25 @@ def gen_and_compile_swift(mogenPath, extra_mogen_args)
45
45
puts run_or_die './testbin'
46
46
end
47
47
48
+ def assert_entity_user_info_respected
49
+ # mogenerator.ignore
50
+ includes_uncle = Dir . entries ( './MOs' ) . any? { |file | file . include? ( 'Uncle' ) }
51
+ raise 'Failed: Ignored entities should not be generated' if includes_uncle
52
+ end
48
53
49
54
desc 'Generate, Compile and Run Objective-C'
50
55
task :objc do
51
56
Rake ::Task [ :clean ] . execute
52
57
gen_and_compile_objc ( MOGENERATOR_PATH , '' , '' )
58
+ assert_entity_user_info_respected
53
59
Rake ::Task [ :clean ] . execute
54
60
end
55
61
56
62
desc 'Generate, Compile and Run Swift'
57
63
task :swift do
58
64
Rake ::Task [ :clean ] . execute
59
65
gen_and_compile_swift ( MOGENERATOR_PATH , '' )
66
+ assert_entity_user_info_respected
60
67
Rake ::Task [ :clean ] . execute
61
68
end
62
69
Original file line number Diff line number Diff line change 55
55
<relationship name =" children" optional =" YES" toMany =" YES" deletionRule =" Cascade" destinationEntity =" Child" indexed =" YES" syncable =" YES" />
56
56
<relationship name =" orderedChildren" optional =" YES" toMany =" YES" deletionRule =" Cascade" ordered =" YES" destinationEntity =" Child" inverseName =" parent" inverseEntity =" Child" indexed =" YES" syncable =" YES" />
57
57
</entity >
58
+ <entity name =" Uncle" representedClassName =" UncleMO" parentEntity =" Human" syncable =" YES" >
59
+ <attribute name =" attribute" optional =" YES" attributeType =" String" syncable =" YES" />
60
+ <userInfo >
61
+ <entry key =" mogenerator.ignore" value =" value" />
62
+ </userInfo >
63
+ </entity >
58
64
<fetchRequest name =" allHumans" entity =" Human" />
59
65
<fetchRequest name =" byHumanName" entity =" Human" predicateString =" humanName == $humanName" />
60
66
<fetchRequest name =" byParent" entity =" Child" predicateString =" parent == $parent" />
69
75
<element name =" EntityWithBaseClass" positionX =" 342" positionY =" 18" width =" 128" height =" 60" />
70
76
<element name =" Human" positionX =" 169" positionY =" 18" width =" 128" height =" 105" />
71
77
<element name =" Parent" positionX =" 34" positionY =" 114" width =" 128" height =" 270" />
78
+ <element name =" Uncle" positionX =" 243" positionY =" -36" width =" 128" height =" 60" />
72
79
</elements >
73
80
</model >
You can’t perform that action at this time.
0 commit comments