Skip to content

Commit

Permalink
Add support for Xcode 15.3 and Xcode 16.0 project formats
Browse files Browse the repository at this point in the history
- Add objectVersion lookup and check for  Xcode 16.0 format
- Resolves #101
  • Loading branch information
dempseyatgithub committed Dec 23, 2024
1 parent 35759b2 commit 841b1e5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions BuildSettingExtractor/BuildSettingExtractor.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@
static NSSet *_compatibilityVersionStringSet;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_compatibilityVersionStringSet = [NSSet setWithObjects:@"Xcode 3.2", @"Xcode 6.3", @"Xcode 8.0", @"Xcode 9.3", @"Xcode 10.0", @"Xcode 11.0", @"Xcode 11.4", @"Xcode 12.0", @"Xcode 13.0", @"Xcode 14.0", @"Xcode 15.0", nil];
_compatibilityVersionStringSet = [NSSet setWithObjects:@"Xcode 3.2", @"Xcode 6.3", @"Xcode 8.0", @"Xcode 9.3", @"Xcode 10.0", @"Xcode 11.0", @"Xcode 11.4", @"Xcode 12.0", @"Xcode 13.0", @"Xcode 14.0", @"Xcode 15.0", @"Xcode 15.3", @"Xcode 16.0", nil];
});
return _compatibilityVersionStringSet;
}

static NSSet *XcodeObjectVersionStringSet(void) {
static NSSet *_objectVersionStringSet;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_objectVersionStringSet = [NSSet setWithObjects:@"77", @"70", nil];
});
return _objectVersionStringSet;
}

@interface BuildSettingExtractor ()
@property (strong) NSMutableDictionary *buildSettingsByTarget;
@property (strong) NSDictionary *objects;
Expand Down Expand Up @@ -143,13 +152,17 @@ - (NSArray *)extractBuildSettingsFromProject:(NSURL *)projectWrapperURL error:(N
return nil;
}

// Get object version
NSString *objectVersion = projectPlist[@"objectVersion"];

// Get root object (project)
self.objects = projectPlist[@"objects"];
NSDictionary *rootObject = self.objects[projectPlist[@"rootObject"]];

// Check compatibility version
NSString *compatibilityVersion = rootObject[@"compatibilityVersion"];
if (![XcodeCompatibilityVersionStringSet() containsObject:compatibilityVersion]) {

if (![XcodeCompatibilityVersionStringSet() containsObject:compatibilityVersion] && ![XcodeObjectVersionStringSet() containsObject:objectVersion]){
if (error) {
*error = [NSError errorForUnsupportedProjectURL:projectWrapperURL fileVersion:compatibilityVersion];
}
Expand Down

0 comments on commit 841b1e5

Please sign in to comment.