@@ -47,8 +47,16 @@ def get_sdk_path(platform):
47
47
return check_output (['xcrun' , '-sdk' , platform , '-show-sdk-path' ])
48
48
49
49
50
- def prepare_module_list (platform , file ):
51
- check_call ([INFER_IMPORT_PATH , '-s' , get_sdk_path (platform )], output = file )
50
+ def prepare_module_list (platform , file , verbose , swift_frameworks_only ):
51
+ cmd = [INFER_IMPORT_PATH , '-s' , get_sdk_path (platform )]
52
+ if swift_frameworks_only :
53
+ cmd .extend (['--swift-frameworks-only' ])
54
+ if verbose :
55
+ cmd .extend (['--v' ])
56
+ check_call (cmd , output = file )
57
+ # The fixed modules are all objc frameworks.
58
+ if swift_frameworks_only :
59
+ return
52
60
with open (INFER_IMPORT_DIR + '/fixed-modules-common.txt' , 'r' ) as extra :
53
61
file .write (extra .read ())
54
62
with open (INFER_IMPORT_DIR + '/fixed-modules-' + platform + '.txt' ,
@@ -78,7 +86,8 @@ def __init__(self, tool_path, platform):
78
86
self .sdk + '/System/Library/Frameworks/' ,
79
87
os .path .realpath (self .sdk + '/../../Library/Frameworks/' )]
80
88
81
- def run (self , output , module , swift_ver , opts , verbose ):
89
+ def run (self , output , module , swift_ver , opts , verbose ,
90
+ swift_frameworks_only ):
82
91
cmd = [self .tool_path , '-o' , output , '-sdk' , self .sdk , '-target' ,
83
92
self .target , '-dump-sdk' , '-module-cache-path' ,
84
93
'/tmp/ModuleCache' , '-swift-version' ,
@@ -93,7 +102,8 @@ def run(self, output, module, swift_ver, opts, verbose):
93
102
check_call (cmd , verbose = verbose )
94
103
else :
95
104
with tempfile .NamedTemporaryFile () as tmp :
96
- prepare_module_list (self .platform , tmp )
105
+ prepare_module_list (self .platform , tmp , verbose ,
106
+ swift_frameworks_only )
97
107
cmd .extend (['-module-list-file' , tmp .name ])
98
108
check_call (cmd , verbose = verbose )
99
109
@@ -147,6 +157,10 @@ def main():
147
157
name of the module/framework to generate baseline, e.g. Foundation
148
158
''' )
149
159
160
+ basic_group .add_argument ('--swift-frameworks-only' ,
161
+ action = 'store_true' ,
162
+ help = 'Only include Swift frameworks in the dump' )
163
+
150
164
basic_group .add_argument ('--opts' , nargs = '+' , default = [], help = '''
151
165
additional flags to pass to swift-api-digester
152
166
''' )
@@ -176,7 +190,8 @@ def main():
176
190
runner = DumpConfig (tool_path = args .tool_path , platform = args .target )
177
191
runner .run (output = args .output , module = args .module ,
178
192
swift_ver = args .swift_version , opts = args .opts ,
179
- verbose = args .v )
193
+ verbose = args .v ,
194
+ swift_frameworks_only = args .swift_frameworks_only )
180
195
elif args .action == 'diagnose' :
181
196
if not args .dump_before :
182
197
fatal_error ("Need to specify --dump-before" )
0 commit comments