@@ -97,7 +97,7 @@ def create_directory(path):
97
97
98
98
99
99
class DumpConfig :
100
- def __init__ (self , tool_path , platform ):
100
+ def __init__ (self , tool_path , platform , platform_alias ):
101
101
target_map = {
102
102
'iphoneos' : 'arm64-apple-ios13.0' ,
103
103
'macosx' : 'x86_64-apple-macosx10.15' ,
@@ -110,6 +110,7 @@ def __init__(self, tool_path, platform):
110
110
self .target = target_map [platform ]
111
111
self .sdk = get_sdk_path (platform )
112
112
self .inputs = []
113
+ self .platform_alias = platform_alias
113
114
if self .platform == 'macosx' :
114
115
# We need this input search path for CreateML
115
116
self .inputs .extend ([self .sdk + '/usr/lib/swift/' ])
@@ -156,7 +157,8 @@ def run(self, output, module, swift_ver, opts, verbose,
156
157
continue
157
158
dir_path = os .path .realpath (output + '/' + module )
158
159
file_path = os .path .realpath (dir_path + '/' +
159
- self .platform + '.json' )
160
+ self .platform_alias +
161
+ '.json' )
160
162
create_directory (dir_path )
161
163
current_cmd = list (cmd )
162
164
current_cmd .extend (['-module' , module ])
@@ -245,6 +247,12 @@ def main():
245
247
action = 'store_true' ,
246
248
help = 'When importing entire SDK, dump content '
247
249
'seprately by module names' )
250
+
251
+ basic_group .add_argument ('--platform-alias' , default = '' , help = '''
252
+ Specify a file name to use if using a platform name in json file isn't
253
+ optimal
254
+ ''' )
255
+
248
256
args = parser .parse_args (sys .argv [1 :])
249
257
250
258
if args .action == 'dump' :
@@ -263,7 +271,10 @@ def main():
263
271
include_fixed_clang_modules = False
264
272
else :
265
273
fatal_error ("cannot recognize --module-filter" )
266
- runner = DumpConfig (tool_path = args .tool_path , platform = args .target )
274
+ if args .platform_alias == '' :
275
+ args .platform_alias = args .target
276
+ runner = DumpConfig (tool_path = args .tool_path , platform = args .target ,
277
+ platform_alias = args .platform_alias )
267
278
runner .run (output = args .output , module = args .module ,
268
279
swift_ver = args .swift_version , opts = args .opts ,
269
280
verbose = args .v ,
0 commit comments