From bf6afe329f3b436f6a625fe3cd589c34b7a285bb Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Mon, 21 Aug 2023 06:36:37 -0700 Subject: [PATCH] Fix electron build on arm64 Summary: Electron-builder puts its results in a different directory, based on the architecture you build on. While we don't have plans to release an arm64 build internally, we still need to support local builds for testing. Without this, it fails with a rather confusing error message: ``` Script termnated. Error: spawn zip ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:476:16) at processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -2, code: 'ENOENT', syscall: 'spawn zip', path: 'zip', spawnargs: [ '-qyr9', '../Flipper-mac.zip', 'Flipper.app' ] ``` Reviewed By: lblasa Differential Revision: D48517426 fbshipit-source-id: 21a133f8fce3aee0737ce5cbccc7a692a613b98e --- desktop/scripts/build-release.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/desktop/scripts/build-release.tsx b/desktop/scripts/build-release.tsx index bccc2b16d..99047dc04 100755 --- a/desktop/scripts/build-release.tsx +++ b/desktop/scripts/build-release.tsx @@ -205,9 +205,13 @@ async function buildDist(buildFolder: string) { if (argv['mac-dmg']) { targetsRaw.push(Platform.MAC.createTarget(['dmg'])); } + const macPath = path.join( + distDir, + process.arch === 'arm64' ? 'mac-arm64' : 'mac', + ); postBuildCallbacks.push(() => spawn('zip', ['-qyr9', '../Flipper-mac.zip', 'Flipper.app'], { - cwd: path.join(distDir, 'mac'), + cwd: macPath, encoding: 'utf-8', }), );