fix(mac): compile each icon asset catalog only once for universal builds#1922
Open
claude[bot] wants to merge 1 commit into
Open
fix(mac): compile each icon asset catalog only once for universal builds#1922claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
`actool` is not guaranteed to produce a byte-identical `Assets.car` across invocations. Universal builds compile the x64 and arm64 slices in the same process, each invoking `actool` independently, so their `Assets.car` files could differ and fail the `@electron/universal` stitch. Memoize the compiled asset catalog by the resolved `.icon` input path so `actool` runs exactly once per icon and both arch slices reuse the identical buffer. Failures are not cached so a transient `actool` error can be retried. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015bvEKdt4wjCAjmWj4rQpfB
MarshallOfSound
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Samuel Attard · Slack thread
Before
When packaging a
universalmacOS app whose icon is a macOS 26 Icon Composer.iconasset, packager builds the x64 and arm64 slices separately and runsactoolonce per slice to compileAssets.car.actooldoes not produce a byte-identicalAssets.caracross invocations, so the two slices ended up with differingAssets.carfiles and the@electron/universalstitching step failed (the files are neither identical nor mergeable as Mach-O).After
actoolis invoked exactly once per.iconand both architecture slices reuse the identical compiled buffer, so the universal stitch sees byte-identicalAssets.carfiles and succeeds. macOS 26.iconuniversal builds now package successfully.How
generateAssetCatalogForIconinsrc/icon-composer.tsnow memoizes the compiled asset catalog in a module-levelMapkeyed by the resolved input.iconpath. The actual compilation moved into a privatecompileAssetCatalogForIconhelper. Because a universal build compiles both arch slices within the same Node process (see thePromise.allover['x64', 'arm64']insrc/universal.ts), the cache guaranteesactoolruns once and both slices reuse the result. Failed compilations are evicted from the cache so a transientactoolerror can be retried. A unit test intest/icon-composer.spec.tsmocksactooland asserts the catalog is compiled only once per unique icon (including across relative/absolute path forms) and recompiled for a distinct icon.This is the root-cause fix preferred over adding a
nonBinaryFilesToIgnoreescape hatch to@electron/universal(see the review on electron/universal#208). It mirrors the approach in electron-userland/electron-builder#9279, which compiled the asset catalog once and reused it across architectures. Related: #1843.Fixes #1843
🤖 Generated with Claude Code
https://claude.ai/code/session_015bvEKdt4wjCAjmWj4rQpfB
Generated by Claude Code