Skip to content

Commit 86fefd0

Browse files
committed
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. I have not added this to the macOS branch because I am unable to test the behavior. This behavior was introduced in other projects that use a similar build-script-helper pattern: see swiftlang/swift-package-manager#9050, swiftlang/sourcekit-lsp#2579, swiftlang/swift-format#1171, and swiftlang/swift-docc#1486.
1 parent 7d6b844 commit 86fefd0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Utilities/build-script-helper.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ def handle_invocation(args):
217217
install(args, args.build_path, targets)
218218
else:
219219
bin_path = swiftpm_bin_path(swift_exec, swiftpm_args, env)
220-
swiftpm('build', swift_exec, swiftpm_args, env)
220+
if not args.install_only:
221+
swiftpm('build', swift_exec, swiftpm_args, env)
221222
non_darwin_install(args, bin_path)
222223
else:
223224
assert False, 'unknown action \'{}\''.format(args.action)
@@ -615,6 +616,7 @@ def add_common_args(parser):
615616
parser.add_argument('--verbose', '-v', action='store_true', help='enable verbose output')
616617
parser.add_argument('--local_compiler_build', action='store_true', help='driver is being built for use with a local compiler build')
617618
parser.add_argument('--enable-asan', action='store_true', help='driver is being built with ASAN support')
619+
parser.add_argument("--install-only", action="store_true", default=False, help="when true, installs without rebuilding")
618620

619621
subparsers = parser.add_subparsers(title='subcommands', dest='action', metavar='action')
620622
clean_parser = subparsers.add_parser('clean', help='clean the package')

0 commit comments

Comments
 (0)