From 735daafdff28e88052ce6c99c748744978ba47fd Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Meunier Date: Wed, 31 Jul 2019 16:06:06 +0200 Subject: [PATCH 1/3] - fix electron mac : add needed helpers for electron 6.0.0 --- .../src/electron/electronMac.ts | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/packages/app-builder-lib/src/electron/electronMac.ts b/packages/app-builder-lib/src/electron/electronMac.ts index aab14f2ba7e..53504da1cf9 100644 --- a/packages/app-builder-lib/src/electron/electronMac.ts +++ b/packages/app-builder-lib/src/electron/electronMac.ts @@ -21,7 +21,8 @@ function moveHelpers(helperSuffixes: Array, frameworksPath: string, appN }) } -function getAvailableHelperSuffixes(helperEHPlist: string | null, helperNPPlist: string | null) { +function getAvailableHelperSuffixes(helperEHPlist: string | null, helperNPPlist: string | null, helperRendererPlist: string | null, helperPluginPlist: string | null, helperGPUPlist: string | null) { + const result = [" Helper"] if (helperEHPlist != null) { result.push(" Helper EH") @@ -29,6 +30,15 @@ function getAvailableHelperSuffixes(helperEHPlist: string | null, helperNPPlist: if (helperNPPlist != null) { result.push(" Helper NP") } + if (helperRendererPlist != null) { + result.push(" Helper (Renderer)"); + } + if (helperPluginPlist != null) { + result.push(" Helper (Plugin)"); + } + if (helperGPUPlist != null) { + result.push(" Helper (GPU)"); + } return result } @@ -45,9 +55,12 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa const helperPlistFilename = path.join(frameworksPath, "Electron Helper.app", "Contents", "Info.plist") const helperEHPlistFilename = path.join(frameworksPath, "Electron Helper EH.app", "Contents", "Info.plist") const helperNPPlistFilename = path.join(frameworksPath, "Electron Helper NP.app", "Contents", "Info.plist") + const helperRendererPlistFilename = path.join(frameworksPath, "Electron Helper (Renderer).app", "Contents", "Info.plist"); + const helperPluginPlistFilename = path.join(frameworksPath, "Electron Helper (Plugin).app", "Contents", "Info.plist"); + const helperGPUPlistFilename = path.join(frameworksPath, "Electron Helper (GPU).app", "Contents", "Info.plist"); const helperLoginPlistFilename = path.join(loginItemPath, "Electron Login Helper.app", "Contents", "Info.plist") - const plistContent: Array = await executeAppBuilderAsJson(["decode-plist", "-f", appPlistFilename, "-f", helperPlistFilename, "-f", helperEHPlistFilename, "-f", helperNPPlistFilename, "-f", helperLoginPlistFilename]) + const plistContent: Array = await executeAppBuilderAsJson(["decode-plist", "-f", appPlistFilename, "-f", helperPlistFilename, "-f", helperEHPlistFilename, "-f", helperNPPlistFilename, "-f", helperRendererPlistFilename, "-f", helperPluginPlistFilename, "-f", helperGPUPlistFilename, "-f", helperLoginPlistFilename]) if (plistContent[0] == null) { throw new Error("corrupted Electron dist") @@ -57,11 +70,14 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa const helperPlist = plistContent[1]!! const helperEHPlist = plistContent[2] const helperNPPlist = plistContent[3] - const helperLoginPlist = plistContent[4] + const helperRendererPlist = plistContent[4]; + const helperPluginPlist = plistContent[5]; + const helperGPUPlist = plistContent[6]; + const helperLoginPlist = plistContent[7] // if an extend-info file was supplied, copy its contents in first - if (plistContent[5] != null) { - Object.assign(appPlist, plistContent[5]) + if (plistContent[8] != null) { + Object.assign(appPlist, plistContent[8]) } const buildMetadata = packager.config!! @@ -90,6 +106,15 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa helper.CFBundleVersion = appPlist.CFBundleVersion } + if (helperRendererPlist != null) { + configureHelper(helperRendererPlist, "(Renderer)"); + } + if (helperPluginPlist != null) { + configureHelper(helperPluginPlist, "(Plugin)"); + } + if (helperGPUPlist != null) { + configureHelper(helperGPUPlist, "(GPU)"); + } if (helperEHPlist != null) { configureHelper(helperEHPlist, "EH") } @@ -158,6 +183,15 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa if (helperNPPlist != null) { plistDataToWrite[helperNPPlistFilename] = helperNPPlist } + if (helperRendererPlist != null) { + plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist; + } + if (helperPluginPlist != null) { + plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist; + } + if (helperGPUPlist != null) { + plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist; + } if (helperLoginPlist != null) { plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist } @@ -169,7 +203,7 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa unlinkIfExists(path.join(appOutDir, "LICENSES.chromium.html")), ]) - await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist), frameworksPath, appFilename, "Electron") + await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist), frameworksPath, appFilename, "Electron") if (helperLoginPlist != null) { const prefix = "Electron" From 1af36d8d93e13ef5a34616c9baabd6e66217083f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Meunier Date: Wed, 31 Jul 2019 16:48:30 +0200 Subject: [PATCH 2/3] - removed semicolons --- .../src/electron/electronMac.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/app-builder-lib/src/electron/electronMac.ts b/packages/app-builder-lib/src/electron/electronMac.ts index 53504da1cf9..28f08a240d6 100644 --- a/packages/app-builder-lib/src/electron/electronMac.ts +++ b/packages/app-builder-lib/src/electron/electronMac.ts @@ -31,13 +31,13 @@ function getAvailableHelperSuffixes(helperEHPlist: string | null, helperNPPlist: result.push(" Helper NP") } if (helperRendererPlist != null) { - result.push(" Helper (Renderer)"); + result.push(" Helper (Renderer)") } if (helperPluginPlist != null) { - result.push(" Helper (Plugin)"); + result.push(" Helper (Plugin)") } if (helperGPUPlist != null) { - result.push(" Helper (GPU)"); + result.push(" Helper (GPU)") } return result } @@ -55,9 +55,9 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa const helperPlistFilename = path.join(frameworksPath, "Electron Helper.app", "Contents", "Info.plist") const helperEHPlistFilename = path.join(frameworksPath, "Electron Helper EH.app", "Contents", "Info.plist") const helperNPPlistFilename = path.join(frameworksPath, "Electron Helper NP.app", "Contents", "Info.plist") - const helperRendererPlistFilename = path.join(frameworksPath, "Electron Helper (Renderer).app", "Contents", "Info.plist"); - const helperPluginPlistFilename = path.join(frameworksPath, "Electron Helper (Plugin).app", "Contents", "Info.plist"); - const helperGPUPlistFilename = path.join(frameworksPath, "Electron Helper (GPU).app", "Contents", "Info.plist"); + const helperRendererPlistFilename = path.join(frameworksPath, "Electron Helper (Renderer).app", "Contents", "Info.plist") + const helperPluginPlistFilename = path.join(frameworksPath, "Electron Helper (Plugin).app", "Contents", "Info.plist") + const helperGPUPlistFilename = path.join(frameworksPath, "Electron Helper (GPU).app", "Contents", "Info.plist") const helperLoginPlistFilename = path.join(loginItemPath, "Electron Login Helper.app", "Contents", "Info.plist") const plistContent: Array = await executeAppBuilderAsJson(["decode-plist", "-f", appPlistFilename, "-f", helperPlistFilename, "-f", helperEHPlistFilename, "-f", helperNPPlistFilename, "-f", helperRendererPlistFilename, "-f", helperPluginPlistFilename, "-f", helperGPUPlistFilename, "-f", helperLoginPlistFilename]) @@ -70,9 +70,9 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa const helperPlist = plistContent[1]!! const helperEHPlist = plistContent[2] const helperNPPlist = plistContent[3] - const helperRendererPlist = plistContent[4]; - const helperPluginPlist = plistContent[5]; - const helperGPUPlist = plistContent[6]; + const helperRendererPlist = plistContent[4] + const helperPluginPlist = plistContent[5] + const helperGPUPlist = plistContent[6] const helperLoginPlist = plistContent[7] // if an extend-info file was supplied, copy its contents in first @@ -107,10 +107,10 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa } if (helperRendererPlist != null) { - configureHelper(helperRendererPlist, "(Renderer)"); + configureHelper(helperRendererPlist, "(Renderer)") } if (helperPluginPlist != null) { - configureHelper(helperPluginPlist, "(Plugin)"); + configureHelper(helperPluginPlist, "(Plugin)") } if (helperGPUPlist != null) { configureHelper(helperGPUPlist, "(GPU)"); @@ -184,13 +184,13 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa plistDataToWrite[helperNPPlistFilename] = helperNPPlist } if (helperRendererPlist != null) { - plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist; + plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist } if (helperPluginPlist != null) { - plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist; + plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist } if (helperGPUPlist != null) { - plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist; + plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist } if (helperLoginPlist != null) { plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist From 755dd907393db0c9e79df0d42038e58ad28ddc54 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Meunier Date: Wed, 31 Jul 2019 16:55:09 +0200 Subject: [PATCH 3/3] - removed a last semicolon --- packages/app-builder-lib/src/electron/electronMac.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app-builder-lib/src/electron/electronMac.ts b/packages/app-builder-lib/src/electron/electronMac.ts index 28f08a240d6..846d5aa971a 100644 --- a/packages/app-builder-lib/src/electron/electronMac.ts +++ b/packages/app-builder-lib/src/electron/electronMac.ts @@ -113,7 +113,7 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa configureHelper(helperPluginPlist, "(Plugin)") } if (helperGPUPlist != null) { - configureHelper(helperGPUPlist, "(GPU)"); + configureHelper(helperGPUPlist, "(GPU)") } if (helperEHPlist != null) { configureHelper(helperEHPlist, "EH")