Skip to content

feat: add nonBinaryFilesToIgnore to allow per-arch non-binary files#208

Open
sgraczyk wants to merge 2 commits into
electron:mainfrom
sgraczyk:feat/non-binary-files-to-ignore
Open

feat: add nonBinaryFilesToIgnore to allow per-arch non-binary files#208
sgraczyk wants to merge 2 commits into
electron:mainfrom
sgraczyk:feat/non-binary-files-to-ignore

Conversation

@sgraczyk

@sgraczyk sgraczyk commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Adds a nonBinaryFilesToIgnore minimatch option to makeUniversalApp. When a non-binary (PLAIN) file's contents differ between the x64 and arm64 builds and its path matches the pattern, the mismatch is allowed and the x64 copy is kept, mirroring the existing hardcoded MainMenu.nib carve-out, but configurable.

Motivation

macOS 26 "Icon Composer" .icon app icons are compiled by actool into Contents/Resources/Assets.car. Tools like @electron/packager run actool once per architecture, and its output is not byte-reproducible — it embeds per-compilation UUIDs in the catalog image names and a per-build timestamp in the .car header. So the x64 and arm64 Assets.car are never identical, and makeUniversalApp aborts with:

Expected all non-binary files to have identical SHAs when creating a universal build but "Contents/Resources/Assets.car" did not

This is reported in #148 and electron/packager#1843. There is currently no escape hatch for non-binary files: singleArchFiles is ASAR-scoped and x64ArchFiles is gated inside the Mach-O loop, so neither can exempt Assets.car. The only existing exception is the hardcoded MainMenu.nib case.

electron-builder hit the same root cause and fixed it (electron-userland/electron-builder#9279) by compiling the catalog once and copying the x64 Assets.car over the arm64 copy before stitching. This PR offers the counterpart on the @electron/universal side: an opt-in allowlist for non-binary files that are deterministic in effect but not byte-identical. Consumers reach it through @electron/packager via packagerConfig.osxUniversal.nonBinaryFilesToIgnore.

Usage

await makeUniversalApp({
  x64AppPath,
  arm64AppPath,
  outAppPath,
  nonBinaryFilesToIgnore: 'Assets.car', // compiled by actool; not byte-reproducible across builds
});

Notes

  • Keeps the x64 copy (the universal app is built from the x64 template), consistent with the MainMenu.nib behavior.
  • No behavior change unless the option is set.
  • Uses the existing matchGlob helper, like x64ArchFiles / infoPlistsToIgnore. The new option is documented via JSDoc on MakeUniversalOpts.
  • Happy to add a README section and a test mirroring the MainMenu.nib path — pointers to the preferred fixture pattern welcome.

Refs #148, electron/packager#1843.

macOS 26 Icon Composer .icon files are compiled by actool into Assets.car with
per-compilation UUIDs and a per-build timestamp, so the x64 and arm64 catalogs are
never byte-identical and makeUniversalApp aborts on the PLAIN-file SHA check (only
MainMenu.nib is currently exempted).

Add a nonBinaryFilesToIgnore minimatch option (matched via the existing matchGlob
helper, like x64ArchFiles/infoPlistsToIgnore). Matching files may differ across
arches; the x64 copy is kept in the universal app.

Refs electron#148, electron/packager#1843.
@sgraczyk sgraczyk requested a review from a team as a code owner June 25, 2026 11:41
Assert the universal merge throws on a differing non-binary file (Assets.car) by
default, and keeps the x64 copy when the path is matched by nonBinaryFilesToIgnore.

@MarshallOfSound MarshallOfSound left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fix this in packager by only running actool once for multiple arches.

Instead of adding to this modules config explosion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants