Skip to content

Commit cd1e298

Browse files
authored
Merge pull request swiftlang#151 from ahoppen/install-module
Fix issue that caused SwiftSyntax's module to not be properly installed
2 parents 998c3d7 + 6d0e3a1 commit cd1e298

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

build-script.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def check_and_sync(file_path, install_path):
372372
if result != 0:
373373
fatal_error("install failed with exit status %d" % (result,))
374374

375-
def install(build_dir, dylib_dir, swiftmodule_dir, stdlib_rpath):
375+
def install(build_dir, dylib_dir, swiftmodule_base_name, stdlib_rpath):
376376
dylibPath = build_dir + '/libSwiftSyntax.dylib'
377377
modulePath = build_dir + '/SwiftSyntax.swiftmodule'
378378
docPath = build_dir + '/SwiftSyntax.swiftdoc'
@@ -383,9 +383,11 @@ def install(build_dir, dylib_dir, swiftmodule_dir, stdlib_rpath):
383383
check_and_sync(file_path=dylibPath,
384384
install_path=dylib_dir+'/'+get_installed_dylib_name())
385385
# 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)
389391
return
390392

391393
### Main
@@ -442,9 +444,14 @@ def main():
442444
help='''
443445
The directory to where the .dylib should be installed.
444446
''')
445-
basic_group.add_argument('--swiftmodule-dir',
447+
basic_group.add_argument('--swiftmodule-base-name',
446448
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
448455
''')
449456

450457
build_group = parser.add_argument_group('Build')
@@ -516,7 +523,7 @@ def main():
516523
build_dir=args.build_dir + '/debug'
517524
stdlib_rpath = realpath(os.path.dirname(args.swiftc_exec) + '/../lib/swift/macosx/')
518525
install(build_dir=build_dir, dylib_dir=args.dylib_dir,
519-
swiftmodule_dir=args.swiftmodule_dir,
526+
swiftmodule_base_name=args.swiftmodule_base_name,
520527
stdlib_rpath=stdlib_rpath)
521528
sys.exit(0)
522529

0 commit comments

Comments
 (0)