[6.2][wasm] Build and install XCTest for Wasm Swift SDK (#83200)

- **Explanation**: Install static XCTest library and its Swift module files into Swift SDK for Wasm
- **Scope**: Narrow, only affects Wasm Swift SDK.
- **Original PRs**: https://github.com/swiftlang/swift/pull/83191
- **Risk**: Low, just a change to Wasm Swift SDK
- **Testing**: CI
- **Reviewers**: @MaxDesiatov
This commit is contained in:
Yuta Saito
2025-07-23 07:06:50 +09:00
committed by GitHub
parent b7c3ceac0f
commit a1a8d73ea2

View File

@@ -190,6 +190,25 @@ class WasmSwiftSDK(product.Product):
shell.call([self.toolchain.cmake, '--install', '.', '--prefix', '/usr'],
env={'DESTDIR': dest_dir})
def _build_xctest(self, swift_host_triple, has_pthread, wasi_sysroot):
xctest = CMakeProduct(
args=self.args,
toolchain=self.toolchain,
source_dir=os.path.join(
os.path.dirname(self.source_dir), 'swift-corelibs-xctest'),
build_dir=os.path.join(self.build_dir, 'xctest', swift_host_triple))
self._append_platform_cmake_options(
xctest.cmake_options, swift_host_triple, has_pthread, wasi_sysroot,
extra_swift_flags=[])
xctest.cmake_options.define('BUILD_SHARED_LIBS', 'FALSE')
xctest.build_with_cmake([], self.args.build_variant, [],
prefer_native_toolchain=True)
dest_dir = self._target_package_path(swift_host_triple)
with shell.pushd(xctest.build_dir):
shell.call([self.toolchain.cmake, '--install', '.', '--prefix', '/usr'],
env={'DESTDIR': dest_dir})
def _build_target_package(self, swift_host_triple, has_pthread,
stdlib_build_path, llvm_runtime_libs_build_path,
wasi_sysroot):
@@ -215,6 +234,7 @@ class WasmSwiftSDK(product.Product):
self._build_foundation(swift_host_triple, has_pthread, wasi_sysroot)
# Build swift-testing
self._build_swift_testing(swift_host_triple, has_pthread, wasi_sysroot)
self._build_xctest(swift_host_triple, has_pthread, wasi_sysroot)
return dest_dir