A practical guide to contributing to the WebKit project. Whether you're a first-time contributor or an experienced developer, this guide covers the essential workflow from setup to submitting a pull request.
- macOS with Xcode installed
- Git
mkdir -p ~/code && cd ~/code
git clone https://github.com/WebKit/WebKit.git webkit
cd webkitgit config core.fsmonitor true
git config pull.rebase trueAdd the following line to your ~/.zshrc so that WebKit helper scripts (e.g. build-webkit, run-webkit-tests) are available globally:
export PATH="$PATH:$HOME/code/webkit/Tools/Scripts"Note: If you skip this step, replace any script references with their full path, e.g.
./Tools/Scripts/build-webkitinstead ofbuild-webkit.
git webkit setupupdate-webkitSee also: WebKit Code Style Guidelines
Write your code, then verify it conforms to WebKit's style:
check-webkit-stylebuild-webkit --debug # Debug build
build-webkit --release # Release build
build-webkit --clean # Remove build artifactsTo generate a compilation database for IDEs (VS Code, CLion, etc.):
build-webkit --export-compile-commandsrun-webkit-tests [path/to/test]| Flag | Description |
|---|---|
--reset-results |
Reset the expected test results |
--new-baseline |
Create a new baseline (equivalent to --reset-results --add-platform-exceptions) |
Import Web Platform Tests by directory:
import-w3c-tests web-platform-tests/cssNote: Only directories are supported, not individual files.
Keep your changes in a single commit:
git add <files>
git commitIf you need to update the commit after further changes:
git commit --amendOr squash multiple commits into one:
git webkit squash [--base-commit <hash>]git webkit pull-request # or: git webkit prOn first run this creates a remote branch and opens a pull request. Subsequent runs push updates to the existing PR.
After submitting your PR and before it is merged, export local WPT changes back to the upstream Web Platform Tests repository:
export-w3c-test-changes -b 18289 -g d184010 -c| Flag | Description |
|---|---|
-b |
The Bugzilla bug ID |
-g |
The upstream WPT commit hash to export against |
-c |
Create the export commit automatically |
Prerequisites:
- You must have a fork of the WPT repository before running this command.
- You need to be a member of the WPT repository to have it work correctly (e.g. to set the
webkit-exportlabel).- You need the editbugs bit to correctly set the "See also" field on WebKit's Bugzilla bug.
See also: WPT Export Process
git webkit checkout <id>Where <id> is a commit hash, branch name, or pull request reference (e.g. pr-12345).