Skip to content

Commit

Permalink
Roll-forward of xcode_locator now that there are no more tools depend…
Browse files Browse the repository at this point in the history
…ing 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
  • Loading branch information
aragos authored and copybara-github committed Feb 27, 2019
1 parent 06eb1bb commit e3c8685
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tools/osx/xcode_locator.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e3c8685

Please sign in to comment.