Skip to content

Commit 4fc7a3c

Browse files
authored
fix(mac): fix errors using native modules that require rebuild when both mas and mac targets are specified (#7744)
1 parent dcb6310 commit 4fc7a3c

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

.changeset/large-brooms-jump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix(mac): fix errors using native modules that require rebuild when both mas and mac targets are specified

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,9 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
156156
}
157157

158158
async pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<void> {
159-
let nonMasPromise: Promise<any> | null = null
160-
161159
const hasMas = targets.length !== 0 && targets.some(it => it.name === "mas" || it.name === "mas-dev")
162160
const prepackaged = this.packagerOptions.prepackaged
163161

164-
if (!hasMas || targets.length > 1) {
165-
const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged
166-
nonMasPromise = (
167-
prepackaged
168-
? Promise.resolve()
169-
: this.doPack(outDir, path.dirname(appPath), this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets)
170-
).then(() => this.packageInDistributableFormat(appPath, arch, targets, taskManager))
171-
}
172-
173162
for (const target of targets) {
174163
const targetName = target.name
175164
if (!(targetName === "mas" || targetName === "mas-dev")) {
@@ -192,8 +181,12 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
192181
}
193182
}
194183

195-
if (nonMasPromise != null) {
196-
await nonMasPromise
184+
if (!hasMas || targets.length > 1) {
185+
const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged
186+
if (prepackaged == null) {
187+
await this.doPack(outDir, path.dirname(appPath), this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets)
188+
}
189+
this.packageInDistributableFormat(appPath, arch, targets, taskManager)
197190
}
198191
}
199192

0 commit comments

Comments
 (0)