From 14a0a05fc6efdfcf1cd73fed28b791c358e53e62 Mon Sep 17 00:00:00 2001 From: Trevor Squires Date: Tue, 29 Aug 2017 08:16:19 -0700 Subject: [PATCH 1/3] Add support for URI and UUID attribute types --- mogenerator.m | 21 ++++++++++++++++++++- momcom/NSAttributeDescription+momcom.m | 5 +++++ test/Rakefile | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mogenerator.m b/mogenerator.m index 784f8c87..4533f987 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -558,8 +558,23 @@ - (NSString*)objectAttributeClassName { result = gSwift ? @"AnyObject" : @"NSObject"; } } else { - result = [self attributeValueClassName]; + // Forcibly generate the correct class name in case we are + // running on macOS < 10.13 + switch ([self attributeType]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpartial-availability" + case NSURIAttributeType: + result = @"NSURL"; + break; + case NSUUIDAttributeType: + result = @"NSUUID"; + break; +#pragma clang diagnostic pop + default: + result = [self attributeValueClassName]; + } } + if (gSwift) { if ([result isEqualToString:@"NSString"]) { result = @"String"; @@ -567,6 +582,10 @@ - (NSString*)objectAttributeClassName { result = @"Date"; } else if ([result isEqualToString:@"NSData"]) { result = @"Data"; + } else if ([result isEqualToString:@"NSURL"]) { + result = @"URL"; + } else if ([result isEqualToString:@"NSUUID"]) { + result = @"UUID"; } } return result; diff --git a/momcom/NSAttributeDescription+momcom.m b/momcom/NSAttributeDescription+momcom.m index 60c4bd2f..63dda0ba 100644 --- a/momcom/NSAttributeDescription+momcom.m +++ b/momcom/NSAttributeDescription+momcom.m @@ -30,6 +30,11 @@ + (void)initialize @"Float" : @(NSFloatAttributeType), @"String" : @(NSStringAttributeType), @"Transformable" : @(NSTransformableAttributeType), +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpartial-availability" + @"URI" : @(NSURIAttributeType), + @"UUID" : @(NSUUIDAttributeType), +#pragma clang diagnostic pop }; }); } diff --git a/test/Rakefile b/test/Rakefile index a203ba88..44aa638f 100644 --- a/test/Rakefile +++ b/test/Rakefile @@ -12,7 +12,7 @@ end #============================== # Variables #============================== -OSX_SDK="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk" +OSX_SDK=run_or_die('xcrun --sdk macosx --show-sdk-path').chomp() OSX_VERSION="10.10" LINKED_FRAMEWORKS="-framework Foundation -framework AppKit -framework CoreData" From e347643f72fa045333145d4b5af16716ae7df463 Mon Sep 17 00:00:00 2001 From: Trevor Squires Date: Thu, 21 Sep 2017 17:23:29 -0700 Subject: [PATCH 2/3] Specify path to 10.13 SDK --- test/Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Rakefile b/test/Rakefile index 44aa638f..6f04d33f 100644 --- a/test/Rakefile +++ b/test/Rakefile @@ -12,7 +12,7 @@ end #============================== # Variables #============================== -OSX_SDK=run_or_die('xcrun --sdk macosx --show-sdk-path').chomp() +OSX_SDK="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk" OSX_VERSION="10.10" LINKED_FRAMEWORKS="-framework Foundation -framework AppKit -framework CoreData" From b100abed5f5fb6083b2c486a18bdce125995c261 Mon Sep 17 00:00:00 2001 From: Trevor Squires Date: Thu, 21 Sep 2017 17:23:41 -0700 Subject: [PATCH 3/3] Update travis config to specify Xcode 9 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a978ab13..b105ef28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode8 +osx_image: xcode9 #xcode_project: mogenerator.xcodeproj #xcode_scheme: mogenerator script: cd test && rake