Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1a3fd9037396b7da74a08e8679d69b16859ce3ec
      
https://github.com/WebKit/WebKit/commit/1a3fd9037396b7da74a08e8679d69b16859ce3ec
  Author: Elliott Williams <[email protected]>
  Date:   2026-04-07 (Tue, 07 Apr 2026)

  Changed paths:
    M Configurations/CommonBase.xcconfig
    M Configurations/WebKitProjectPaths.xcconfig
    A Source/JavaScriptCore/API/WorkAround173516139.h
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/JavaScriptCore_Private.modulemap
    M Source/WTF/Configurations/WTF.xcconfig
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WebCore/PAL/Configurations/PAL.xcconfig
    M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/WebCore_Private.modulemap
    A Source/WebCore/WorkAround173516139.h
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
    M Source/WebGPU/WebGPU/WebGPU_Private.modulemap
    A Source/WebGPU/WebGPU/WorkAround173516139.h
    M Source/WebKitLegacy/Modules/WebKitLegacy.private.modulemap
    A Source/WebKitLegacy/Modules/WorkAround173516139.h
    M Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj
    M Source/bmalloc/Configurations/bmalloc.xcconfig
    M Source/bmalloc/bmalloc.xcodeproj/project.pbxproj

  Log Message:
  -----------
  [Build] Clang modules do not rebuild when headers are added, breaking 
incremental builds
https://bugs.webkit.org/show_bug.cgi?id=311206
rdar://173516139

Reviewed by Richard Robinson.

Reland of 310331@main with a workaround for rdar://157581667, which was
causing a spurious build cycle on some incremental builds.

Modules that use the `umbrella` directive implicitly depend on a
directory's contents. That is, when ANY header in the directory changes,
the module must rebuild. This model is defective when headers are added,
because the build system has no concept of "negative" dependencies, i.e.
it only tracks dependencies on paths that already exists. We believe
this has been the cause of a steady stream of incremental build bugs in
modularized code this year, most recently seen in
https://bugs.webkit.org/show_bug.cgi?id=310896.

While the underlying issue is fixed in the compiler or build system,
add some workarounds to our own modules to force them to rebuild
whenever our projects' header lists change:

1. At the start of the build, Xcode emits a VFS file to the
   intermediates directory. It uses this file during compilation, and we
   already depend on it for other header-related processing tasks,
   namely generating the TAPI filelist that we use to merge WTF and
   bmalloc's API into JavaScriptCore.

2. Use this VFS file (WK_HEADERS_VFS_FILE) as an input edge to build
   rules in our targets that influence the module. The idea is that any
   change to this file (when headers are added/removed) invalidates the
   module, causing a rebuild.

   The exact manner we do this depends on the target type:

   a. For library targets, add a build rule that produces modulemaps
      containing this input edge. This takes precedence over the generic
      file copy task which copies the modulemap(s) into the library's
      header directory.

   b. For framework targets, we do not have direct control over the task
      that produces the modulemap, as it is controlled natively via the
      MODULEMAP_FILE buld setting. Instead, add a header
      ("WorkAround173516139.h") to each framework that has a modulemap
      containing an `umbrella` directive. This header is produced by a
      build rule using the same input edge technique, such that whenever
      the header list changes, this header must be rebuilt, which in
      turn rebuilds the module.

3. The new headers in framework targets need to be discovered by
   existing incremental builds, so add a comment above every `umbrella`
   directive to force the respective module to rebuild.

* Configurations/CommonBase.xcconfig:
* Configurations/WebKitProjectPaths.xcconfig: Move WK_HEADERS_VFS_FILE
  definition out of specific targets.
* Source/JavaScriptCore/API/WorkAround173516139.h: Added.
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/JavaScriptCore_Private.modulemap:
* Source/WTF/Configurations/WTF.xcconfig:
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/Configurations/PAL.xcconfig:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/WebCore_Private.modulemap:
* Source/WebCore/WorkAround173516139.h: Added.
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/WebGPU_Private.modulemap:
* Source/WebGPU/WebGPU/WorkAround173516139.h: Added.
* Source/WebKitLegacy/Modules/WebKitLegacy.private.modulemap:
* Source/WebKitLegacy/Modules/WorkAround173516139.h: Added.
* Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj:
* Source/bmalloc/Configurations/bmalloc.xcconfig:
* Source/bmalloc/bmalloc.xcodeproj/project.pbxproj:

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



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

Reply via email to