From e3c8685d694b735a59dcd6ba740d8d3030e845a5 Mon Sep 17 00:00:00 2001 From: schmitt Date: Tue, 26 Feb 2019 17:09:53 -0800 Subject: [PATCH] Roll-forward of xcode_locator now that there are no more tools depending on the old version. *** Original change description *** Support Xcode betas with xcode-locator Previously if you had 2 builds of the same version of Xcode, for example 10.2.0 beta 1 and 10.2.0 beta 2, there was no way to disambiguate them. This change appends the `ProductBuildVersion` of each Xcode version to allow you to specify that if desired. Closes #7371. PiperOrigin-RevId: 235823433 --- tools/osx/xcode_locator.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/osx/xcode_locator.m b/tools/osx/xcode_locator.m index 6e318d7e56636b..71b0b1427bf2be 100644 --- a/tools/osx/xcode_locator.m +++ b/tools/osx/xcode_locator.m @@ -176,6 +176,14 @@ static void AddEntryToDictionary( NSLog(@"Version strings for %@: short=%@, expanded=%@", url, version, expandedVersion); + NSURL *versionPlistUrl = [url URLByAppendingPathComponent:@"Contents/version.plist"]; + NSDictionary *versionPlistContents = [[NSDictionary alloc] initWithContentsOfURL:versionPlistUrl + error:nil]; + NSString *productVersion = [versionPlistContents objectForKey:@"ProductBuildVersion"]; + if (productVersion) { + expandedVersion = [expandedVersion stringByAppendingFormat:@".%@", productVersion]; + } + NSURL *developerDir = [url URLByAppendingPathComponent:@"Contents/Developer"]; XcodeVersionEntry *entry = @@ -259,12 +267,6 @@ int main(int argc, const char * argv[]) { versionArg = @""; } else { versionArg = firstArg; - NSCharacterSet *versSet = - [NSCharacterSet characterSetWithCharactersInString:@"0123456789."]; - if ([versionArg rangeOfCharacterFromSet:versSet.invertedSet].length - != 0) { - versionArg = nil; - } } } if (versionArg == nil) {