Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 04934aedb7f1d2c35013ed0a5ed61f6a06a14975
      
https://github.com/WebKit/WebKit/commit/04934aedb7f1d2c35013ed0a5ed61f6a06a14975
  Author: Brandon Stewart <[email protected]>
  Date:   2026-05-23 (Sat, 23 May 2026)

  Changed paths:
    M Source/cmake/WebKitMacros.cmake

  Log Message:
  -----------
  [CMake] Swift typecheck step races _CopyHeaders on clean builds
https://bugs.webkit.org/show_bug.cgi?id=315424
rdar://177781369

Reviewed by Adrian Taylor and Geoffrey Garen.

On a clean build, the PAL Swift C++-interop typecheck step intermittently
fails with:

    error: underlying Objective-C module 'pal' not found
    @_exported public import pal
    error: no such module 'pal.Core.crypto.CryptoTypes'

The same step succeeds on the next build. Root cause is a missing edge in
the ninja graph: `_webkit_setup_swift_header_deps` collects the framework's
`_CopyHeaders` / `_CopyPrivateHeaders` targets into `${_deps}` and attaches
them only to the outer `${_target}_SwiftCxxHeader` ordering target. That
gates the framework's main Swift compilation, but not the
`add_custom_command(OUTPUT ${_stamp} ...)` that runs `swiftc -typecheck`
to emit the C++ interop header. The typecheck command's DEPENDS list is
`${_swift_sources} ${_target}_SwiftGeneratedDeps`, where
`_SwiftGeneratedDeps` carries only binary-dir headers from
`${_target}_HEADERS` / `${_target}_DERIVED_SOURCES`.

Source-tree headers staged via `_CopyHeaders` (e.g.
`PAL/Headers/pal/crypto/CryptoTypes.h`) are therefore not inputs to the
typecheck node. Ninja can schedule the typecheck before the framework's
umbrella header directory is fully populated, at which point Clang's
`umbrella "."` discovery in the staged module.modulemap fails to resolve
the imports requested by pal.swift's `import pal.Core.crypto.CryptoTypes`.

Add the `_CopyHeaders` targets as dependencies of `_SwiftGeneratedDeps`
so the typecheck node itself waits for header staging, not just the outer
`_SwiftCxxHeader` target. The fix is symmetric across PAL, WebGPU, etc.;
all consumers of `WEBKIT_SETUP_SWIFT_AND_GENERATE_SWIFT_CPP_INTEROP_HEADER`
benefit.

* Source/cmake/WebKitMacros.cmake:

Canonical link: https://commits.webkit.org/313799@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to