aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/xcode
diff options
context:
space:
mode:
authorGravatar Chris Parsons <cparsons@google.com>2016-06-23 22:26:02 +0000
committerGravatar Lukacs Berki <lberki@google.com>2016-06-24 08:12:33 +0000
commit32b3ef567602b4e5de97ab8044ed8cf780d5372e (patch)
tree67c69b321b23deddbda7adcb4dac9ded5d118229 /src/tools/xcode
parentbaf44c99b5c23c8b2d4ee7a9ff390306f532ecfd (diff)
"xcode_locator -v" dedupes multiple copies of the same xcode version installed on the host, and appends DEVELOPER_DIR to the specification on each line.
This should be the last of what is needed from this option, in order to launch local generated xcode_config and xcode_version targets in skylark. -- MOS_MIGRATED_REVID=125725500
Diffstat (limited to 'src/tools/xcode')
-rw-r--r--src/tools/xcode/xcodelocator/xcode_locator.m18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/tools/xcode/xcodelocator/xcode_locator.m b/src/tools/xcode/xcodelocator/xcode_locator.m
index 49392591e6..1c79357559 100644
--- a/src/tools/xcode/xcodelocator/xcode_locator.m
+++ b/src/tools/xcode/xcodelocator/xcode_locator.m
@@ -115,7 +115,8 @@ int main(int argc, const char * argv[]) {
"to return the path to the appropriate developer directory.\nOmitting a version "
"number will list all available versions in JSON format, alongside their paths.\n"
"Passing -v will list all available fully-specified version numbers along with "
- "their possible aliases, each on a new line. For example: '7.3.1:7,7.3,7.3.1'.\n");
+ "their possible aliases and their developer directory, each on a new line.\n"
+ "For example: '7.3.1:7,7.3,7.3.1:/Applications/Xcode.app/Contents/Developer'.\n");
return 1;
}
@@ -155,9 +156,20 @@ int main(int argc, const char * argv[]) {
if (versionsOnly) {
NSSet *distinctValues = [[NSSet alloc] initWithArray:[dict allValues]];
+ NSMutableDictionary *aliasDict = [[NSMutableDictionary alloc] init];
for (XcodeVersionEntry *value in distinctValues) {
- printf("%s:", value.version.UTF8String);
- printf("%s\n", [[dict allKeysForObject:value] componentsJoinedByString: @","].UTF8String);
+ NSString *versionString = value.version;
+ if (aliasDict[versionString] == nil) {
+ aliasDict[versionString] = [[NSMutableSet alloc] init];
+ }
+ [aliasDict[versionString] addObjectsFromArray:[dict allKeysForObject:value]];
+ }
+ for (NSString *version in aliasDict) {
+ XcodeVersionEntry *entry = dict[version];
+ printf("%s:%s:%s\n",
+ version.UTF8String,
+ [[aliasDict[version] allObjects] componentsJoinedByString: @","].UTF8String,
+ entry.url.fileSystemRepresentation);
}
} else {
// Print out list in json format.