Skip to content

Commit 686d655

Browse files
[wasm] Build and install XCTest for Wasm Swift SDK
Install static XCTest library and its Swift module files in the following directory structure: ``` usr/lib/swift_static/wasi/libXCTest.a usr/lib/swift_static/wasi/XCTest.swiftmodule ```
1 parent a4ad806 commit 686d655

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

utils/swift_build_support/swift_build_support/products/wasmswiftsdk.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,26 @@ def _build_swift_testing(self, swift_host_triple, has_pthread, wasi_sysroot):
193193
shell.call([self.toolchain.cmake, '--install', '.', '--prefix', '/usr'],
194194
env={'DESTDIR': dest_dir})
195195

196+
def _build_xctest(self, swift_host_triple, has_pthread, wasi_sysroot):
197+
xctest = CMakeProduct(
198+
args=self.args,
199+
toolchain=self.toolchain,
200+
source_dir=os.path.join(
201+
os.path.dirname(self.source_dir), 'swift-corelibs-xctest'),
202+
build_dir=os.path.join(self.build_dir, 'xctest', swift_host_triple))
203+
self._append_platform_cmake_options(
204+
xctest.cmake_options, swift_host_triple, has_pthread, wasi_sysroot,
205+
extra_swift_flags=[])
206+
xctest.cmake_options.define('BUILD_SHARED_LIBS', 'FALSE')
207+
208+
xctest.build_with_cmake([], self.args.build_variant, [],
209+
prefer_native_toolchain=True,
210+
ignore_extra_cmake_options=True)
211+
dest_dir = self._target_package_path(swift_host_triple)
212+
with shell.pushd(xctest.build_dir):
213+
shell.call([self.toolchain.cmake, '--install', '.', '--prefix', '/usr'],
214+
env={'DESTDIR': dest_dir})
215+
196216
def _build_target_package(self, swift_host_triple, has_pthread,
197217
stdlib_build_path, llvm_runtime_libs_build_path,
198218
wasi_sysroot):
@@ -218,6 +238,7 @@ def _build_target_package(self, swift_host_triple, has_pthread,
218238
self._build_foundation(swift_host_triple, has_pthread, wasi_sysroot)
219239
# Build swift-testing
220240
self._build_swift_testing(swift_host_triple, has_pthread, wasi_sysroot)
241+
self._build_xctest(swift_host_triple, has_pthread, wasi_sysroot)
221242

222243
return dest_dir
223244

0 commit comments

Comments
 (0)