@@ -91,32 +91,14 @@ def main():
91
91
'|sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer| '
92
92
'if you are using Xcode 4.' ) % job .returncode )
93
93
94
- sdk_command = ['xcodebuild' ,
95
- '-showsdks' ,
96
- '-json' ]
97
- sdk_json_output = run_command_with_retry (sdk_command , timeout = 300 )
98
- sdk_json = json .loads (sdk_json_output )
99
-
100
- best_sdk = None
101
- sdk_output = None
102
-
103
- # Xcode can return the same version for different symlinked paths.
104
- # Sort by path to keep the list stable between runs.
105
- for properties in sorted (list (sdk_json ), key = lambda d : d ['sdkPath' ]):
106
- # Filter out macOS DriverKit, watchOS, AppleTV, and other SDKs.
107
- if properties .get ('platform' ) != 'macosx' or 'driver' in properties .get ('canonicalName' ):
108
- continue
109
- sdk_version = properties ['sdkVersion' ]
110
- parsed_version = parse_version (sdk_version )
111
- if (parsed_version >= parse_version (min_sdk_version ) and
112
- (not best_sdk or parsed_version < parse_version (best_sdk ))):
113
- best_sdk = sdk_version
114
- sdk_output = properties ['sdkPath' ]
115
-
116
- if not best_sdk :
117
- print (sdk_json_output )
118
- raise Exception ('No %s+ SDK found' % min_sdk_version )
119
-
94
+ # xcrun --sdk macosx --show-sdk-path
95
+ sdk_command = [
96
+ 'xcrun' ,
97
+ '--sdk' ,
98
+ 'macosx' ,
99
+ '--show-sdk-path' ,
100
+ ]
101
+ sdk_output = run_command_with_retry (sdk_command , timeout = 300 )
120
102
if symlink_path :
121
103
sdks_path = os .path .join (symlink_path , 'SDKs' )
122
104
symlink_target = os .path .join (sdks_path , os .path .basename (sdk_output ))
@@ -125,7 +107,6 @@ def main():
125
107
126
108
if not options .as_gclient_hook :
127
109
print (sdk_output )
128
- print (best_sdk )
129
110
return 0
130
111
131
112
0 commit comments