<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>315424</bug_id>
          
          <creation_ts>2026-05-23 07:50:06 -0700</creation_ts>
          <short_desc>[CMake] Swift typecheck step races _CopyHeaders on clean builds</short_desc>
          <delta_ts>2026-05-23 19:56:29 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brandon">brandonstewart</reporter>
          <assigned_to name="Brandon">brandonstewart</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2213527</commentid>
    <comment_count>0</comment_count>
    <who name="Brandon">brandonstewart</who>
    <bug_when>2026-05-23 07:50:06 -0700</bug_when>
    <thetext>On a clean build, the PAL Swift C++-interop typecheck step intermittently
fails with:

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

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&apos;s
`_CopyHeaders` / `_CopyPrivateHeaders` targets into `${_deps}` and attaches
them only to the outer `${_target}_SwiftCxxHeader` ordering target. That
gates the framework&apos;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&apos;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&apos;s
umbrella header directory is fully populated, at which point Clang&apos;s
`umbrella &quot;.&quot;` discovery in the staged module.modulemap fails to resolve
the imports requested by pal.swift&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2213528</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-05-23 07:50:12 -0700</bug_when>
    <thetext>&lt;rdar://problem/177781369&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2213529</commentid>
    <comment_count>2</comment_count>
    <who name="Brandon">brandonstewart</who>
    <bug_when>2026-05-23 07:51:35 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/65537</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2213578</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-05-23 19:56:27 -0700</bug_when>
    <thetext>Committed 313799@main (04934aedb7f1): &lt;https://commits.webkit.org/313799@main&gt;

Reviewed commits have been landed. Closing PR #65537 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>