build: fix mksnapshot path in mksnapshot_args for flattened macOS zips (#53363)

Since the macOS release snapshot tools moved into a secondary toolchain
(#52884), gn desc emits the mksnapshot executable path as
./clang_<arch>_snapshot/mksnapshot, but electron_mksnapshot_zip flattens
mksnapshot.zip so the binary lives at the zip root. The Fixup Mksnapshot
step never rewrote that first argument, so every darwin mksnapshot.zip
published since then ships an mksnapshot_args pointing at a path that
does not exist in the zip and @electron/mksnapshot fails with ENOENT.

Rewrite the leading ./clang_*_snapshot/ prefix to ./ so the args file
matches the flattened layout. Linux is unaffected: its cross-arch
toolchain dir (clang_x64_v8_arm64) does not match the pattern and its
zips are not flattened.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
claude[bot]andClaude authored and GitHub committed 2026-09-01 11:55:26 -04:00
1 parent 9a6dbb512e
commit 5beb642ddb
1 file changed
+6
@@ -261,6 +261,12 @@ runs:
sed $SEDOPTION '/--reorder-builtins/d' out/Default/mksnapshot_args
sed $SEDOPTION '/--warn-about-builtin-profile-data/d' out/Default/mksnapshot_args
sed $SEDOPTION '/--abort-on-bad-builtin-profile-data/d' out/Default/mksnapshot_args
# When mksnapshot is built in a secondary toolchain (macOS release
# builds, see //electron/build/toolchain/mac), gn desc emits its path
# as ./clang_<arch>_snapshot/mksnapshot, but electron_mksnapshot_zip
# flattens the zip so the binary lives at the root. Point the args at
# the flattened location so @electron/mksnapshot can spawn it.
sed $SEDOPTION 's|^\./clang_[a-z0-9_]*_snapshot/mksnapshot|./mksnapshot|' out/Default/mksnapshot_args
if [ "$TARGET_PLATFORM" = "win" ]; then
cd out/Default