From a0826d1194fe16f3030d441ba70c516c0187c2dd Mon Sep 17 00:00:00 2001 From: 3405691582 Date: Mon, 23 Mar 2026 21:22:45 -0400 Subject: [PATCH] Add option to install without building. This allows the build action to be decoupled from the install action, so packaging systems that expect to be able to do discrete installation steps post-build can do so cheaply, without having to effectively start the build over from scratch. To match existing behavior, this defaults to being disabled. This was introduced previously in swiftlang/swift-package-manager#9050, and the flag has the same name used there. --- Utilities/build-script-helper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Utilities/build-script-helper.py b/Utilities/build-script-helper.py index e70e98f1..0dc9a6ab 100755 --- a/Utilities/build-script-helper.py +++ b/Utilities/build-script-helper.py @@ -268,9 +268,10 @@ def install(swift_exec: str, args: argparse.Namespace) -> None: additional_env = get_swiftpm_environment_variables(swift_exec, args) bin_path = swiftpm_bin_path(swift_exec, swiftpm_args=swiftpm_args, additional_env=additional_env) - build_single_product('sourcekit-lsp', swift_exec, args) - build_single_product('SwiftSourceKitPlugin', swift_exec, args) - build_single_product('SwiftSourceKitClientPlugin', swift_exec, args) + if not args.install_only: + build_single_product('sourcekit-lsp', swift_exec, args) + build_single_product('SwiftSourceKitPlugin', swift_exec, args) + build_single_product('SwiftSourceKitClientPlugin', swift_exec, args) if platform.system() == 'Darwin': dynamic_library_extension = "dylib" @@ -339,6 +340,7 @@ def parse_args() -> argparse.Namespace: install_parser = subparsers.add_parser('install', help='build the package') add_common_args(install_parser) install_parser.add_argument('--prefix', dest='install_prefixes', nargs='*', metavar='PATHS', help="paths to install sourcekit-lsp, default: 'toolchain/bin'") + install_parser.add_argument('--install-only', action='store_true', default=False) args = parser.parse_args(sys.argv[1:])