Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3526fd25329cc96fbe4fabb4d66c940d63f51214
https://github.com/WebKit/WebKit/commit/3526fd25329cc96fbe4fabb4d66c940d63f51214
Author: Richard Robinson <[email protected]>
Date: 2025-12-09 (Tue, 09 Dec 2025)
Changed paths:
M Source/WTF/Configurations/WTF.xcconfig
A Source/WTF/Scripts/modules-verifier/GenerateModuleVerifierInputsTask.py
A Source/WTF/Scripts/modules-verifier/ModuleVerifierLanguage.py
A Source/WTF/Scripts/modules-verifier/ModuleVerifierTypes.py
A Source/WTF/Scripts/modules-verifier/VerifyModuleTask.py
A Source/WTF/Scripts/modules-verifier/library-modules-verifier.py
M Source/WTF/WTF.xcodeproj/project.pbxproj
M Source/WebCore/PAL/Configurations/PAL.xcconfig
M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
M Source/bmalloc/Configurations/bmalloc.xcconfig
M Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
Log Message:
-----------
[Swift in WebKit] Create a custom module verifier for libraries in WebKit
https://bugs.webkit.org/show_bug.cgi?id=303716
rdar://166025196
Reviewed by Mike Wyrzykowski.
Since Xcode and SWBuild only support verifying framework modules, create a
custom module verifier for
libraries, and use it to verify the bmalloc, WTF, and PAL libraries.
This is enormously beneficial since errors will directly arise for all
incorrect files in the verified
library; this contrasts with the current state of affairs where module issues
in libraries are only
discovered once one of the "bad" header files are included by a framework which
is modularized, and
which will then report the downstream issues, which is basically just playing
module whack-a-mole.
The design and logic of this verifier are based on the builtin module verifier
of SwiftBuild. The
verifier works by following these steps:
1. The verifier is passed in a JSON list of header files in a TAPI format in a
command-line argument,
that correspond to all exposed header files of the library.
2. The verifier then constructs a set of input generation tasks based on the
files and the environment to
cover all combinations of verifiable languages and architectures.
3. These tasks are then invoked, each of which creates a Dummy framework that
includes all the headers of
the library.
4. For each input generation task, a corresponding module verifier task is then
created which forms the
arguments for a clang command.
5. Each module verifier task is invoked, which compiles the implementation file
that includes the Dummy
framework, using a set of compiler flags which validate possible module-related
issues.
6. The verification passes if the tool exits with a return code of zero,
indicating compilation succeeded.
The verifier was designed to be as generic as possible, and also uses most of
the same environment
variables as the builtin module verifier for consistency. However, instead of
using
`ENABLE_MODULE_VERIFIER`, a new `ENABLE_WK_LIBRARY_MODULE_VERIFIER` variable is
used instead, just to
avoid the possibility of accidentally conflicting with the builtin module
verifier logic.
For now, `ENABLE_WK_LIBRARY_MODULE_VERIFIER` is set to `NO` for all libraries,
since the verifier
revealed several dozen issues across the libraries. Once these are fixed, this
flag will be set to `YES`,
preventing any future issues.
Note that this is the recommended solution for verifying library modules, since
the builtin module
verifier is designed to only be used with frameworks.
* Source/WTF/Configurations/WTF.xcconfig:
* Source/WTF/Scripts/modules-verifier/GenerateModuleVerifierInputsTask.py:
Added.
(_module_verifier_target_set_combinations):
(GenerateModuleVerifierInputsTask):
(GenerateModuleVerifierInputsTask.create_tasks):
(GenerateModuleVerifierInputsTask.__init__):
(GenerateModuleVerifierInputsTask.perform_action):
* Source/WTF/Scripts/modules-verifier/ModuleVerifierLanguage.py: Added.
(LanguageStandard):
(LanguageStandard.c_standards):
(LanguageStandard.cxx_standards):
(Language):
(Language.supported_standards):
(Language.include_statement):
(Language.source_file_extension):
(verify_languages):
* Source/WTF/Scripts/modules-verifier/ModuleVerifierTypes.py: Added.
(ModuleVerifierTarget):
(ModuleVerifierTarget.value):
(ModuleVerifierInputs):
(ModuleVerifierTargetSet):
(ModuleVerifierTargetSet.path_component):
* Source/WTF/Scripts/modules-verifier/VerifyModuleTask.py: Added.
(VerifyModuleTask):
(VerifyModuleTask.__init__):
(VerifyModuleTask.create_command):
(VerifyModuleTask.perform_action):
* Source/WTF/Scripts/modules-verifier/library-modules-verifier.py: Added.
(CommandArguments):
(FileListHeader):
(FileList):
(parse_command_arguments):
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/Configurations/PAL.xcconfig:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/bmalloc/Configurations/bmalloc.xcconfig:
* Source/bmalloc/bmalloc.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/304193@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications