Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mac): fix errors using native modules that require rebuild when the mac target is multiple and contains mas #7744

Merged
merged 5 commits into from
Aug 31, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 4 additions & 13 deletions packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,9 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
}

async pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<void> {
let nonMasPromise: Promise<any> | null = null

const hasMas = targets.length !== 0 && targets.some(it => it.name === "mas" || it.name === "mas-dev")
const prepackaged = this.packagerOptions.prepackaged

if (!hasMas || targets.length > 1) {
const appPath = prepackaged == null ? path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`) : prepackaged
nonMasPromise = (
prepackaged
? Promise.resolve()
: this.doPack(outDir, path.dirname(appPath), this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets)
).then(() => this.packageInDistributableFormat(appPath, arch, targets, taskManager))
}

for (const target of targets) {
const targetName = target.name
if (!(targetName === "mas" || targetName === "mas-dev")) {
Expand All @@ -192,8 +181,10 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
}
}

if (nonMasPromise != null) {
await nonMasPromise
if ((!hasMas || targets.length > 1) && !prepackaged) {
const appPath = path.join(this.computeAppOutDir(outDir, arch), `${this.appInfo.productFilename}.app`);
await this.doPack(outDir, path.dirname(appPath), this.platform.nodeName as ElectronPlatformName, arch, this.platformSpecificBuildOptions, targets)
.then(() => this.packageInDistributableFormat(appPath, arch, targets, taskManager))
mmaietta marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down