Skip to content

Commit f464e3e

Browse files
authoredJun 14, 2023
fix: Allow building MAS and MAC targets with different appId (#7603)
1 parent 4dce371 commit f464e3e

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed
 

‎.changeset/famous-shrimps-return.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix: Allow building MAS and dmg targets with different appId

‎packages/app-builder-lib/src/electron/electronMac.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,16 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa
117117
if (oldHelperBundleId != null) {
118118
log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId")
119119
}
120-
const helperBundleIdentifier = filterCFBundleIdentifier(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`)
120+
121+
const defaultAppId = packager.platformSpecificBuildOptions.appId
122+
const cfBundleIdentifier = filterCFBundleIdentifier((isMas ? packager.config.mas?.appId : defaultAppId) || defaultAppId || appInfo.macBundleIdentifier)
123+
124+
const defaultHelperId = packager.platformSpecificBuildOptions.helperBundleId
125+
const helperBundleIdentifier = filterCFBundleIdentifier(
126+
(isMas ? packager.config.mas?.helperBundleId : defaultHelperId) || defaultHelperId || oldHelperBundleId || `${cfBundleIdentifier}.helper`
127+
)
128+
129+
appPlist.CFBundleIdentifier = cfBundleIdentifier
121130

122131
await packager.applyCommonInfo(appPlist, contentsPath)
123132

@@ -168,7 +177,7 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa
168177
helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`
169178
helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`
170179
// noinspection SpellCheckingInspection
171-
helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`
180+
helperLoginPlist.CFBundleIdentifier = `${cfBundleIdentifier}.loginhelper`
172181
helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion
173182
}
174183

‎packages/app-builder-lib/src/macPackager.ts

-2
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,6 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
445445
appPlist.LSMinimumSystemVersion = minimumSystemVersion
446446
}
447447

448-
appPlist.CFBundleIdentifier = appInfo.macBundleIdentifier
449-
450448
appPlist.CFBundleShortVersionString = this.platformSpecificBuildOptions.bundleShortVersion || appInfo.version
451449
appPlist.CFBundleVersion = appInfo.buildVersion
452450

0 commit comments

Comments
 (0)
Please sign in to comment.