@@ -44,6 +44,8 @@ def check_output(cmd, verbose=False):
44
44
45
45
46
46
def get_sdk_path (platform ):
47
+ if platform .startswith ('iosmac' ):
48
+ platform = 'macosx'
47
49
return check_output (['xcrun' , '-sdk' , platform , '-show-sdk-path' ])
48
50
49
51
@@ -94,14 +96,24 @@ def __init__(self, tool_path, platform):
94
96
'macosx' : 'x86_64-apple-macosx10.15' ,
95
97
'appletvos' : 'arm64-apple-tvos13.0' ,
96
98
'watchos' : 'armv7k-apple-watchos6.0' ,
99
+ 'iosmac' : 'x86_64-apple-ios13.0-macabi' ,
97
100
}
98
101
self .tool_path = get_api_digester_path (tool_path )
99
102
self .platform = platform
100
103
self .target = target_map [platform ]
101
104
self .sdk = get_sdk_path (platform )
105
+ self .inputs = []
106
+ if self .platform == 'macosx' :
107
+ # We need this input search path for CreateML
108
+ self .inputs .extend ([self .sdk + '/usr/lib/swift/' ])
102
109
self .frameworks = [
103
110
self .sdk + '/System/Library/Frameworks/' ,
104
111
os .path .realpath (self .sdk + '/../../Library/Frameworks/' )]
112
+ if self .platform .startswith ('iosmac' ):
113
+ # Catalyst modules need this extra framework dir
114
+ iOSSupport = self .sdk + \
115
+ '/System/iOSSupport/System/Library/Frameworks'
116
+ self .frameworks .extend ([iOSSupport ])
105
117
106
118
def run (self , output , module , swift_ver , opts , verbose ,
107
119
module_filter_flags , include_fixed_clang_modules ,
@@ -110,15 +122,19 @@ def run(self, output, module, swift_ver, opts, verbose,
110
122
self .target , '-dump-sdk' , '-module-cache-path' ,
111
123
'/tmp/ModuleCache' , '-swift-version' ,
112
124
swift_ver , '-abort-on-module-fail' ]
125
+ _environ = dict (os .environ )
126
+ _environ ['SWIFT_FORCE_MODULE_LOADING' ] = 'prefer-interface'
113
127
for path in self .frameworks :
114
128
cmd .extend (['-iframework' , path ])
129
+ for path in self .inputs :
130
+ cmd .extend (['-I' , path ])
115
131
cmd .extend (['-' + o for o in opts ])
116
132
if verbose :
117
133
cmd .extend (['-v' ])
118
134
if module :
119
135
cmd .extend (['-module' , module ])
120
136
cmd .extend (['-o' , output ])
121
- check_call (cmd , verbose = verbose )
137
+ check_call (cmd , env = _environ , verbose = verbose )
122
138
else :
123
139
with tempfile .NamedTemporaryFile () as tmp :
124
140
prepare_module_list (self .platform , tmp , verbose ,
@@ -138,11 +154,11 @@ def run(self, output, module, swift_ver, opts, verbose,
138
154
current_cmd = list (cmd )
139
155
current_cmd .extend (['-module' , module ])
140
156
current_cmd .extend (['-o' , file_path ])
141
- check_call (current_cmd , verbose = verbose )
157
+ check_call (current_cmd , env = _environ , verbose = verbose )
142
158
else :
143
159
cmd .extend (['-o' , output ])
144
160
cmd .extend (['-module-list-file' , tmp .name ])
145
- check_call (cmd , verbose = verbose )
161
+ check_call (cmd , env = _environ , verbose = verbose )
146
162
147
163
148
164
class DiagnoseConfig :
0 commit comments