Skip to content

Commit 6f6ce0a

Browse files
authored
build-script: Add --install-wasmkit option (#82871)
This allows skipping the installation for WasmKit when building it, which is consistent to how other products are handled by `build-script`, where they have separate `--install` options. Existing behavior is preserved: passing `--wasmkit` alone will install it, but now `--wasmkit --install-wasmkit false` will skip its installation step.
2 parents 7637665 + 0b7f21e commit 6f6ce0a

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

utils/build-presets.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@ swift-testing-macros
862862
xctest
863863
swiftdocc
864864
swiftformat
865+
wasmkit
865866

866867
build-ninja
867868
install-llvm
@@ -879,12 +880,11 @@ install-prefix=/usr
879880
install-sourcekit-lsp
880881
install-swiftformat
881882
install-swiftdocc
883+
install-wasmkit
882884
build-swift-static-stdlib
883885
build-swift-static-sdk-overlay
884886
build-swift-stdlib-unittest-extra
885887
build-embedded-stdlib-cross-compiling
886-
887-
wasmkit
888888
build-wasm-stdlib
889889

890890
# Executes the lit tests for the installable package that is created
@@ -958,6 +958,7 @@ mixin-preset=buildbot_linux
958958

959959
llvm-targets-to-build=X86;ARM;AArch64;WebAssembly
960960
wasmkit
961+
install-wasmkit
961962
build-wasm-stdlib
962963
# FIXME(katei): Test fails on a specific CI node.
963964
# https://github.com/apple/swift/issues/70980
@@ -1416,6 +1417,7 @@ install-playgroundsupport
14161417
install-sourcekit-lsp
14171418
install-swiftformat
14181419
install-swiftdocc
1420+
install-wasmkit
14191421

14201422
install-destdir=%(install_destdir)s
14211423

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,18 @@ def create_argument_parser():
823823
option(['--build-minimal-stdlib'], toggle_true('build_minimalstdlib'),
824824
help='build the \'minimal\' freestanding stdlib variant into a '
825825
'separate build directory ')
826+
827+
# Wasm options
828+
826829
option(['--build-wasm-stdlib'], toggle_true('build_wasmstdlib'),
827830
help='build the stdlib for WebAssembly target into a'
828831
'separate build directory ')
829832
option(['--wasmkit'], toggle_true('build_wasmkit'),
830833
help='build WasmKit')
834+
option(['--install-wasmkit'], toggle_true('install_wasmkit'),
835+
help='install SourceKitLSP')
836+
837+
# Swift Testing options
831838

832839
option('--swift-testing', toggle_true('build_swift_testing'),
833840
help='build Swift Testing')

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
'install_swift_testing_macros': False,
120120
'install_swift_driver': False,
121121
'install_swiftdocc': False,
122+
'install_wasmkit': False,
122123
'swiftsyntax_verify_generated_files': False,
123124
'swiftsyntax_enable_rawsyntax_validation': False,
124125
'swiftsyntax_enable_test_fuzzing': False,
@@ -684,6 +685,7 @@ class BuildScriptImplOption(_BaseOption):
684685
EnableOption('--install-swiftformat', dest='install_swiftformat'),
685686
EnableOption('--install-skstresstester', dest='install_skstresstester'),
686687
EnableOption('--install-swiftdocc', dest='install_swiftdocc'),
688+
EnableOption('--install-wasmkit', dest='install_wasmkit'),
687689
EnableOption('--toolchain-benchmarks', dest='build_toolchainbenchmarks'),
688690
EnableOption('--swift-inspect', dest='build_swift_inspect'),
689691
EnableOption('--tsan-libdispatch-test'),

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)