Skip to content

Commit aaa4fab

Browse files
authored
Merge pull request #22046 from nkcsgexi/install-swift-syntax-separately
build-script: add a flag to separately install SwiftSyntax artifacts.
2 parents 8944665 + ced5044 commit aaa4fab

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

utils/build-script

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,10 @@ def main_preset():
993993
help="Print the expanded build-script invocation generated "
994994
"by the preset, but do not run the preset",
995995
action=arguments.action.optional_bool)
996+
parser.add_argument(
997+
"--swiftsyntax-install-prefix",
998+
help="specify the directory to where SwiftSyntax should be installed")
996999
args = parser.parse_args()
997-
9981000
if len(args.preset_file_names) == 0:
9991001
args.preset_file_names = [
10001002
os.path.join(
@@ -1044,6 +1046,10 @@ def main_preset():
10441046
build_script_args += ["--distcc"]
10451047
if args.build_jobs:
10461048
build_script_args += ["--jobs", str(args.build_jobs)]
1049+
if args.swiftsyntax_install_prefix:
1050+
build_script_args += ["--install-swiftsyntax",
1051+
"--install-destdir",
1052+
args.swiftsyntax_install_prefix]
10471053

10481054
diagnostics.note('using preset "{}", which expands to \n\n{}\n'.format(
10491055
args.preset, shell.quote_command(build_script_args)))

utils/build-script-impl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,8 +3566,18 @@ for host in "${ALL_HOSTS[@]}"; do
35663566
exit 1
35673567
fi
35683568
echo "--- Installing ${product} ---"
3569-
DYLIB_DIR="${host_install_destdir}${host_install_prefix}/lib/swift/${SWIFT_HOST_VARIANT}"
3570-
MODULE_DIR="${DYLIB_DIR}/${SWIFT_HOST_VARIANT_ARCH}"
3569+
if [ "${BUILD_LIBPARSER_ONLY}" ]; then
3570+
# We don't have a toolchain so we should install to the specified dir
3571+
DYLIB_DIR="${INSTALL_DESTDIR}"
3572+
MODULE_DIR="${INSTALL_DESTDIR}"
3573+
# Install libParser is necessary
3574+
rsync -a "$(build_directory ${host} swift)/lib/lib_InternalSwiftSyntaxParser.dylib" "${INSTALL_DESTDIR}"
3575+
else
3576+
# We have a toolchain so install to the toolchain
3577+
DYLIB_DIR="${host_install_destdir}${host_install_prefix}/lib/swift/${SWIFT_HOST_VARIANT}"
3578+
MODULE_DIR="${DYLIB_DIR}/${SWIFT_HOST_VARIANT_ARCH}"
3579+
fi
3580+
35713581
if [[ -z "${SKIP_INSTALL_SWIFTSYNTAX_MODULE}" ]] ; then
35723582
call "${swiftsyntax_build_command[@]}" --dylib-dir="${DYLIB_DIR}" --swiftmodule-dir "${MODULE_DIR}" --install
35733583
else

0 commit comments

Comments
 (0)