Skip to content

Commit 69eebd9

Browse files
authored
Merge pull request #318 from ahoppen/pr/install-swiftsyntaxparser
Build and install SwiftSyntaxParser from `build-script.py`
2 parents 206ad18 + b0b567a commit 69eebd9

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

build-script.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ def clear_gyb_files_from_previous_run(sources_dir, destination_dir, verbose):
325325
# Building SwiftSyntax
326326

327327

328-
def get_installed_dylib_name():
329-
return "libSwiftSyntax.dylib"
328+
def get_installed_dylib_names():
329+
return ["libSwiftSyntax.dylib", "libSwiftSyntaxParser.dylib"]
330330

331331

332332
def get_swiftpm_invocation(toolchain, action, build_dir, multiroot_data_file, release):
@@ -608,23 +608,23 @@ def check_and_sync(file_path, install_path):
608608

609609

610610
def install(build_dir, dylib_dir, swiftmodule_base_name, stdlib_rpath):
611-
dylib_name = get_installed_dylib_name()
611+
for dylib_name in get_installed_dylib_names():
612612

613-
dylib_path = os.path.join(build_dir, dylib_name)
614-
module_path = os.path.join(build_dir, "SwiftSyntax.swiftmodule")
615-
doc_path = os.path.join(build_dir, "SwiftSyntax.swiftdoc")
613+
dylib_path = os.path.join(build_dir, dylib_name)
614+
615+
# users should find the dylib as if it's a part of stdlib.
616+
change_id_rpath(os.path.join("@rpath", dylib_name), dylib_path)
616617

617-
# users should find the dylib as if it's a part of stdlib.
618-
change_id_rpath(os.path.join("@rpath", dylib_name), dylib_path)
619-
620-
# we don't wanna hard-code the stdlib dylibs into rpath.
621-
delete_rpath(stdlib_rpath, dylib_path)
622-
check_and_sync(
623-
file_path=dylib_path, install_path=os.path.join(dylib_dir, dylib_name)
624-
)
618+
# we don't wanna hard-code the stdlib dylibs into rpath.
619+
delete_rpath(stdlib_rpath, dylib_path)
620+
check_and_sync(
621+
file_path=dylib_path, install_path=os.path.join(dylib_dir, dylib_name)
622+
)
625623

626624
# Optionally install .swiftmodule
627625
if swiftmodule_base_name:
626+
module_path = os.path.join(build_dir, "SwiftSyntax.swiftmodule")
627+
doc_path = os.path.join(build_dir, "SwiftSyntax.swiftdoc")
628628
module_dest = swiftmodule_base_name + ".swiftmodule"
629629
doc_dest = swiftmodule_base_name + ".swiftdoc"
630630
check_and_sync(file_path=module_path, install_path=module_dest)
@@ -797,9 +797,9 @@ def main():
797797

798798
if args.install:
799799
if not args.dylib_dir:
800-
fatal_error("Must specify directory to install")
800+
fatal_error("Must specify directory to install (--dylib-dir)")
801801
if not args.build_dir:
802-
fatal_error("Must specify build directory to copy from")
802+
fatal_error("Must specify build directory to copy from (--build-dir)")
803803
if args.release:
804804
build_dir = os.path.join(args.build_dir, "release")
805805
else:
@@ -857,7 +857,10 @@ def main():
857857
verbose=args.verbose,
858858
disable_sandbox=args.disable_sandbox,
859859
)
860+
# Until rdar://53881101 is implemented, we cannot request a build of multiple
861+
# targets simultaneously. For now, just build one product after the other.
860862
builder.build("SwiftSyntax", module_group_path=GROUP_INFO_PATH)
863+
builder.build("SwiftSyntaxParser", module_group_path=GROUP_INFO_PATH)
861864

862865
# Only build lit-test-helper if we are planning to run tests
863866
if args.test:

0 commit comments

Comments
 (0)