#51804: build: only ship grit resources the binary actually references (Linux)
Repacks the locale .pak files against a resource allowlist derived from the binary itself, and adds a build-time check that every resource the binary can request is actually shipped.
- enable grit resource allowlisting in release builds; the allowlist is extracted from the electron executable's exact link inputs via a
--collect-inputs-onlypseudo-link, regenerated every build, no hand-maintained list - repack
locales/*.pakwith that allowlist (only strings reachable from native code are kept) - add
electron_resource_allowlist_check, which fails the build if a referenced resource is missing from the shipped paks — and pack everything it found missing today (components_branded_stringserror-page / Web Bluetooth strings, content-layerchrome://internals pages, extension renderer bindings, theme/autofill/lottie resources referenced via grit resource maps) - one-line Chromium patch to allow allowlist generation for desktop Linux/macOS
| Linux x64 | before | after |
|---|---|---|
| locales (55 paks) | 46.8 MB | 7.6 MB |
| resources.pak | 7.0 MB | 7.5 MB |
| chrome_100/200_percent.pak | 0.3 MB | 1.8 MB |
| net dist size | ~297 MB | ~260 MB (−37 MB) |
Enabled for both testing and release builds, so the allowlist check acts as a PR CI gate: a change that references an unshipped resource fails its own CI instead of the next release build. The first CI runs after this lands will be slower while compile caches repopulate (the grit-generated headers all change).
Verified against a full-pak build: localized strings (en/de/ja/hi), DevTools, PDF viewer, printToPDF, chrome://histograms. Windows (PDB extraction) and macOS (Mach-O support in the upstream script) are follow-ups; on those platforms this change only adds inert marker symbols.
Notes: Reduced the Linux distribution size by ~37 MB by only shipping locale strings and resources that Electron can actually use.
Backports
No Backports Requested
This pull request doesn't have any backports requested or created for older release branches.
What are backports?
Backports are copies of changes made to the main branch that are applied to older release branches. They ensure that bug fixes and important changes are available in maintained older versions of Electron.
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron