@@ -372,7 +372,7 @@ def check_and_sync(file_path, install_path):
372
372
if result != 0 :
373
373
fatal_error ("install failed with exit status %d" % (result ,))
374
374
375
- def install (build_dir , dylib_dir , swiftmodule_dir , stdlib_rpath ):
375
+ def install (build_dir , dylib_dir , swiftmodule_base_name , stdlib_rpath ):
376
376
dylibPath = build_dir + '/libSwiftSyntax.dylib'
377
377
modulePath = build_dir + '/SwiftSyntax.swiftmodule'
378
378
docPath = build_dir + '/SwiftSyntax.swiftdoc'
@@ -383,9 +383,11 @@ def install(build_dir, dylib_dir, swiftmodule_dir, stdlib_rpath):
383
383
check_and_sync (file_path = dylibPath ,
384
384
install_path = dylib_dir + '/' + get_installed_dylib_name ())
385
385
# Optionally install .swiftmodule
386
- if swiftmodule_dir :
387
- check_and_sync (file_path = modulePath ,install_path = swiftmodule_dir )
388
- check_and_sync (file_path = docPath ,install_path = swiftmodule_dir )
386
+ if swiftmodule_base_name :
387
+ module_dest = swiftmodule_base_name + '.swiftmodule'
388
+ doc_dest = swiftmodule_base_name + '.swiftdoc'
389
+ check_and_sync (file_path = modulePath ,install_path = module_dest )
390
+ check_and_sync (file_path = docPath ,install_path = doc_dest )
389
391
return
390
392
391
393
### Main
@@ -442,9 +444,14 @@ def main():
442
444
help = '''
443
445
The directory to where the .dylib should be installed.
444
446
''' )
445
- basic_group .add_argument ('--swiftmodule-dir ' ,
447
+ basic_group .add_argument ('--swiftmodule-base-name ' ,
446
448
help = '''
447
- The directory to where the .swiftmodule should be installed.
449
+ The name under which the Swift module should be installed. A .swiftdoc and
450
+ .swiftmodule file extension will be added to this path and the
451
+ corresponding files will be copied there.
452
+ Example /path/to/SwiftSyntax.swiftmodule/x86_64 copies files to
453
+ /path/to/SwiftSyntax.swiftmodule/x86_64.swiftmodule and
454
+ /path/to/SwiftSyntax.swiftmodule/x86_64.swiftdoc
448
455
''' )
449
456
450
457
build_group = parser .add_argument_group ('Build' )
@@ -516,7 +523,7 @@ def main():
516
523
build_dir = args .build_dir + '/debug'
517
524
stdlib_rpath = realpath (os .path .dirname (args .swiftc_exec ) + '/../lib/swift/macosx/' )
518
525
install (build_dir = build_dir , dylib_dir = args .dylib_dir ,
519
- swiftmodule_dir = args .swiftmodule_dir ,
526
+ swiftmodule_base_name = args .swiftmodule_base_name ,
520
527
stdlib_rpath = stdlib_rpath )
521
528
sys .exit (0 )
522
529
0 commit comments