Skip to content

Commit

Permalink
fix(mac): Remove redundant signing op for mas and mas-dev targets (#4321
Browse files Browse the repository at this point in the history
)
  • Loading branch information
oNaiPs authored and develar committed Oct 22, 2019
1 parent f858f9e commit 5692281
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
}
}

private hasMasTarget(targets: Array<Target>) {
return targets.length !== 0 && targets.some(it => it.name === "mas" || it.name === "mas-dev")
}

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

This comment has been minimized.

Copy link
@patrickmichalina

patrickmichalina Dec 9, 2019

const appFileName = `${this.appInfo.productFilename}.app`;

await _bluebirdLst().default.map((0, _fsExtra().readdir)(packContext.appOutDir), file => {
    const inputPath = path.join(packContext.appOutDir, file)
      
    if (file === appFileName && !inputPath.indexOf('/mas/')) {
      return this.sign(inputPath, null, null);
    }

    return null;
});

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

if (!hasMas || targets.length > 1) {
Expand Down Expand Up @@ -323,12 +327,16 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise<any> {
const appFileName = `${this.appInfo.productFilename}.app`

await BluebirdPromise.map(readdir(packContext.appOutDir), (file: string): any => {
if (file === appFileName) {
return this.sign(path.join(packContext.appOutDir, file), null, null)
}
return null
})
const hasMas = this.hasMasTarget(packContext.targets)
// No need to sign on mas targets since we sign the folder on pack()
if (!hasMas) {

This comment has been minimized.

Copy link
@gaodeng

gaodeng Feb 3, 2020

Contributor

The logic here is incorrect. If we need to build both mas and non-mas versions, this will cause code signing for non-mas targets to be skipped @oNaiPs @develar

This comment has been minimized.

Copy link
@gaodeng

gaodeng Feb 12, 2020

Contributor

@oNaiPs any news?

This comment has been minimized.

Copy link
@oNaiPs

oNaiPs Feb 16, 2020

Author Contributor

Apologies I didn't have time to work on this yet. Is this a simple fix?

This comment has been minimized.

Copy link
@gaodeng

gaodeng Feb 17, 2020

Contributor

The easiest fix is to undo this commit. Although there are redundant signing op, but the final output is correct.
@oNaiPs @develar

This comment has been minimized.

Copy link
@patrickmichalina

patrickmichalina Jul 6, 2020

I think the redundant signing breaks MAS builds. I am investigating again.

await BluebirdPromise.map(readdir(packContext.appOutDir), (file: string): any => {
if (file === appFileName) {
return this.sign(path.join(packContext.appOutDir, file), null, null)
}
return null
})
}

if (!isAsar) {
return
Expand Down

0 comments on commit 5692281

Please sign in to comment.