Skip to content

Commit

Permalink
fix: Allow building MAS and MAC targets with different appId (#7603)
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielNSD committed Jun 14, 2023
1 parent 4dce371 commit f464e3e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-shrimps-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

fix: Allow building MAS and dmg targets with different appId
13 changes: 11 additions & 2 deletions packages/app-builder-lib/src/electron/electronMac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa
if (oldHelperBundleId != null) {
log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId")
}
const helperBundleIdentifier = filterCFBundleIdentifier(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`)

const defaultAppId = packager.platformSpecificBuildOptions.appId
const cfBundleIdentifier = filterCFBundleIdentifier((isMas ? packager.config.mas?.appId : defaultAppId) || defaultAppId || appInfo.macBundleIdentifier)

const defaultHelperId = packager.platformSpecificBuildOptions.helperBundleId
const helperBundleIdentifier = filterCFBundleIdentifier(
(isMas ? packager.config.mas?.helperBundleId : defaultHelperId) || defaultHelperId || oldHelperBundleId || `${cfBundleIdentifier}.helper`
)

appPlist.CFBundleIdentifier = cfBundleIdentifier

await packager.applyCommonInfo(appPlist, contentsPath)

Expand Down Expand Up @@ -168,7 +177,7 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa
helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`
helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`
// noinspection SpellCheckingInspection
helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`
helperLoginPlist.CFBundleIdentifier = `${cfBundleIdentifier}.loginhelper`
helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion
}

Expand Down
2 changes: 0 additions & 2 deletions packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,6 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
appPlist.LSMinimumSystemVersion = minimumSystemVersion
}

appPlist.CFBundleIdentifier = appInfo.macBundleIdentifier

appPlist.CFBundleShortVersionString = this.platformSpecificBuildOptions.bundleShortVersion || appInfo.version
appPlist.CFBundleVersion = appInfo.buildVersion

Expand Down

0 comments on commit f464e3e

Please sign in to comment.