Skip to content

Commit 407bbb6

Browse files
committed
build-script: Add --install-wasmkit option
This allows skipping the installation step and only building WasmKit, which is consistent to how other products are handled by `build-script`, where they have separate `--install` options. Existing behavior is preserved, where passing `--wasmkit` alone will install it, but now `--wasmkit --install-wasmkit false` will skip its installation step.
1 parent b37d0f6 commit 407bbb6

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ def _apply_default_arguments(args):
292292
args.test_xros_host = False
293293
args.test_android_host = False
294294

295+
# Install WasmKit if it's built
296+
# (ideally, should not be installed by default, same as other products, but
297+
# historically `--wasmkit` implied installation)
298+
if args.build_wasmkit and args.install_wasmkit is None:
299+
args.install_wasmkit = True
300+
295301

296302
def create_argument_parser():
297303
"""Return a configured argument parser."""
@@ -823,11 +829,18 @@ def create_argument_parser():
823829
option(['--build-minimal-stdlib'], toggle_true('build_minimalstdlib'),
824830
help='build the \'minimal\' freestanding stdlib variant into a '
825831
'separate build directory ')
832+
833+
# Wasm options
834+
826835
option(['--build-wasm-stdlib'], toggle_true('build_wasmstdlib'),
827836
help='build the stdlib for WebAssembly target into a'
828837
'separate build directory ')
829838
option(['--wasmkit'], toggle_true('build_wasmkit'),
830839
help='build WasmKit')
840+
option(['--install-wasmkit'], toggle_true('install_wasmkit'),
841+
help='install SourceKitLSP')
842+
843+
# Swift Testing options
831844

832845
option('--swift-testing', toggle_true('build_swift_testing'),
833846
help='build Swift Testing')

utils/swift_build_support/swift_build_support/products/wasmkit.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def should_test(self, host_target):
4747
return False
4848

4949
def should_install(self, host_target):
50-
# Currently, it's only used for testing stdlib.
51-
return True
50+
return self.args.install_wasmkit
5251

5352
def install(self, host_target):
5453
"""
@@ -61,10 +60,10 @@ def install(self, host_target):
6160

6261
def build(self, host_target):
6362
bin_path = run_swift_build(host_target, self, 'wasmkit-cli')
64-
print("Built wasmkit-cli at: " + bin_path)
63+
print("Built wasmkit-cli at: " + bin_path, flush=True)
6564
# Copy the built binary to ./bin
6665
dest_bin_path = self.__class__.cli_file_path(self.build_dir)
67-
print("Copying wasmkit-cli to: " + dest_bin_path)
66+
print("Copying wasmkit-cli to: " + dest_bin_path, flush=True)
6867
os.makedirs(os.path.dirname(dest_bin_path), exist_ok=True)
6968
shutil.copy(bin_path, dest_bin_path)
7069

0 commit comments

Comments
 (0)