Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 681430f8805ed3bd1367d1bb0cead18f5c668766
https://github.com/WebKit/WebKit/commit/681430f8805ed3bd1367d1bb0cead18f5c668766
Author: Zak Ridouh <[email protected]>
Date: 2026-07-31 (Fri, 31 Jul 2026)
Changed paths:
M Tools/TestWebKitAPI/PlatformCocoa.cmake
Log Message:
-----------
[CMake] Enable explicit module builds for the TestWebKitAPI Swift targets
https://bugs.webkit.org/show_bug.cgi?id=320684
rdar://183668313
Reviewed by Elliott Williams.
The Test* targets hand-roll their Swift flags in TESTWEBKITAPI_SWIFT_FLAGS
rather than going through _WEBKIT_TARGET_SETUP, so they never reached the
explicit-module-build block that WebKit, WebGPU and PAL opt into via
${_target}_SWIFT_EXPLICIT_MODULE_BUILD. Setting that variable here has no
effect; the flags have to be passed directly.
All seven Test* targets compile the same five Runner/*.swift files against
the same C++ interop modules, so with implicit modules the first target to
run populates the whole Clang module cache from scratch while the rest wait
on it. Measured on a mac-dev-debug build (M3 Max), rebuilding the seven
runner Swift edges with a cold SwiftModuleCache:
wall cold edge sum of edges module cache
implicit modules 203s 192.3s 236.4s 985 MB / 540 PCMs
explicit modules 38s 29.0s 71.0s 498 MB / 1448 PCMs
That is a 165s (-81%) improvement, and the cache is half the size despite
holding finer-grained, deduplicated modules. The clean-build benchmark
deletes the build directory, so it always starts from a cold module cache
and sees the full win. Warm edges are ~7s either way, so incremental builds
are unaffected.
This matches Xcode, which already builds these targets with explicit Swift
modules: Tools/TestWebKitAPI/Configurations/Base.xcconfig sets
_SWIFT_EXPLICIT_MODULES_ALLOW_CXX_INTEROP to WK_SUPPORTS_SWIFT_OBJCXX_INTEROP.
No SDK gating is needed -- the only setter that carves out SDKs is bmalloc,
whose constraint is about SDKs tc module, and this
whole block is already inside if (WEBKIT_SDK_IS_MACOS), where
WK_SUPPORTS_SWIFT_OBJCXX_INTEROP
The two -Xcc experimental-attribt optional: without
them clang rejects the cached SwiftShims PCM with "experimental late parsing
of attributes was enabled in prently disabled".
They mirror the other three explicit-module-build sites in the CMake build
(WebKitMacros.cmake for WebKit/W and
_WebKit_SwiftUI in Source/WebKit/PlatformCocoa.cmake). They are a CMake-only
workaround; Xcode needs neither.
* Tools/TestWebKitAPI/PlatformCocoa.cmake:
Canonical link: https://commits.webkit.org/318339@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications