diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-08-27 11:27:55 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-08-27 11:27:55 +0200 |
| commit | a19cbced618252dc94ee471e1d63b49cd08c2bc0 (patch) | |
| tree | 2d01508536248c53fb4e115c7f5488ac8aa04491 | |
| parent | 8ee94508542052b13df115737f6b3a3300cd682e (diff) | |
| parent | c905b2dbd79566348f9812d5df3f7d0c6516a077 (diff) | |
| download | mullvadvpn-a19cbced618252dc94ee471e1d63b49cd08c2bc0.tar.xz mullvadvpn-a19cbced618252dc94ee471e1d63b49cd08c2bc0.zip | |
Merge branch 'fix-universal-build'
| -rw-r--r-- | gui/tasks/distribution.js | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js index 753af6e53e..d4932b4a44 100644 --- a/gui/tasks/distribution.js +++ b/gui/tasks/distribution.js @@ -200,7 +200,7 @@ function packWin() { } function packMac() { - let appOutDir; + const appOutDirs = []; return builder.build({ targets: builder.Platform.MAC.createTarget(), @@ -224,24 +224,32 @@ function packMac() { }, afterPack: (context) => { delete process.env.TARGET_TRIPLE; - - appOutDir = context.appOutDir; + appOutDirs.push(context.appOutDir); return Promise.resolve(); }, afterAllArtifactBuild: async (buildResult) => { if (!noAppleNotarization) { + // buildResult.artifactPaths[0] contains the path to the pkg. await notarizeMac(buildResult.artifactPaths[0]); } - // remove the folder that contains the unpacked app - return fs.promises.rm(appOutDir, { recursive: true }); + + // Remove the folder that contains the unpacked app. Electron builder cleans up some of + // these directories and it's changed between versions without a mention in the changelog. + for (const dir of appOutDirs) { + try { + await fs.promises.rm(dir, { recursive: true }); + } catch {} + } + }, + afterSign: (context) => { + const appOutDir = context.appOutDir; + appOutDirs.push(appOutDir); + + if (!noAppleNotarization) { + const appName = context.packager.appInfo.productFilename; + return notarizeMac(path.join(appOutDir, `${appName}.app`)); + } }, - afterSign: noAppleNotarization - ? undefined - : (context) => { - const appOutDir = context.appOutDir; - const appName = context.packager.appInfo.productFilename; - return notarizeMac(path.join(appOutDir, `${appName}.app`)); - }, }, }); } |
