Skip to content

Commit

Permalink
feat: win custom sign should have same signature of doSign (#4833)
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Xu <henry.xu@ringcentral.com>
  • Loading branch information
link89 and link89 committed Apr 1, 2020
1 parent f418be0 commit f938de5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/app-builder-lib/src/codeSign/windowsCodeSign.ts
Expand Up @@ -15,7 +15,7 @@ export function getSignVendorPath() {
return getBin("winCodeSign")
}

export type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration) => Promise<any>
export type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration, packager?: WinPackager) => Promise<any>

export interface WindowsSignOptions {
readonly path: string
Expand Down Expand Up @@ -55,18 +55,14 @@ export async function sign(options: WindowsSignOptions, packager: WinPackager) {
hashes = Array.isArray(hashes) ? hashes : [hashes]
}

function defaultExecutor(configuration: CustomWindowsSignTaskConfiguration) {
return doSign(configuration, packager)
}

const executor = resolveFunction(options.options.sign, "sign") || defaultExecutor
const executor = resolveFunction(options.options.sign, "sign") || doSign
let isNest = false
for (const hash of hashes) {
const taskConfiguration: WindowsSignTaskConfiguration = {...options, hash, isNest}
await executor({
...taskConfiguration,
computeSignToolArgs: isWin => computeSignToolArgs(taskConfiguration, isWin)
})
}, packager)
isNest = true
if (taskConfiguration.resultOutputPath != null) {
await rename(taskConfiguration.resultOutputPath, options.path)
Expand Down Expand Up @@ -138,7 +134,7 @@ export async function getCertificateFromStoreInfo(options: WindowsConfiguration,
throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`)
}

async function doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {
export async function doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {
// https://github.com/electron-userland/electron-builder/pull/1944
const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000

Expand Down

0 comments on commit f938de5

Please sign in to comment.