Skip to content

Commit

Permalink
fix: make computeSignToolArgs usable in custom signing
Browse files Browse the repository at this point in the history
Close #2397
  • Loading branch information
develar committed Mar 17, 2018
1 parent c68741e commit cfec5c6
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 107 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"yargs": "^11.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.42",
"@develar/gitbook": "3.2.11",
"@types/debug": "^0.0.30",
"@types/ejs": "^2.5.0",
Expand All @@ -82,7 +83,7 @@
"@types/semver": "^5.5.0",
"@types/source-map-support": "^0.4.0",
"@types/stat-mode": "^0.2.0",
"babel-preset-ts-node6-bluebird": "^1.0.1",
"babel-preset-ts-node6-bluebird": "^2.0.1",
"convert-source-map": "^1.5.1",
"decompress-zip": "^0.3.0",
"depcheck": "^0.6.9",
Expand All @@ -99,7 +100,7 @@
"jest-junit": "^3.6.0",
"jsdoc-to-markdown": "^4.0.1",
"path-sort": "^0.1.0",
"ts-babel": "^4.1.8",
"ts-babel": "^5.0.1",
"ts-jsdoc": "^3.0.0",
"tslint": "^5.9.1",
"typescript": "2.7.2",
Expand Down
19 changes: 14 additions & 5 deletions packages/electron-builder-lib/src/winPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@ export class WinPackager extends PlatformPackager<WindowsConfiguration> {
readonly cscInfo = new Lazy<FileCodeSigningInfo | CertificateFromStoreInfo | null>(() => {
const platformSpecificBuildOptions = this.platformSpecificBuildOptions
if (platformSpecificBuildOptions.certificateSubjectName != null || platformSpecificBuildOptions.certificateSha1 != null) {
if (platformSpecificBuildOptions.sign != null) {
return Promise.resolve(null)
}
return this.vm.value.then(vm => getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))
return this.vm.value
.then(vm => getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))
.catch(e => {
// https://github.com/electron-userland/electron-builder/pull/2397
if (platformSpecificBuildOptions.sign == null) {
throw e
}
else {
log.debug({error: e}, "getCertificateFromStoreInfo error")
return null
}
})
}

const certificateFile = platformSpecificBuildOptions.certificateFile
Expand Down Expand Up @@ -323,7 +331,8 @@ export class WinPackager extends PlatformPackager<WindowsConfiguration> {
}

const timer = time("wine&sign")
await execWine(path.join(await getSignVendorPath(), `rcedit-${process.arch}.exe`), args)
// wine supports only ia32
await execWine(path.join(await getSignVendorPath(), `rcedit-${process.platform === "win32" ? process.arch : "ia32"}.exe`), args)
await this.sign(file)
timer.end()

Expand Down
5 changes: 3 additions & 2 deletions packages/electron-builder-lib/src/windowsCodeSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ function computeSignToolArgs(options: WindowsSignTaskConfiguration, isWin: boole
args.push(isWin ? "/ac" : "-ac", vm.toVmFile(options.options.additionalCertificateFile))
}

if (!isWin && process.env.HTTPS_PROXY) {
args.push("-p", process.env.HTTPS_PROXY)
const httpsProxyFromEnv = process.env.HTTPS_PROXY
if (!isWin && httpsProxyFromEnv != null && httpsProxyFromEnv.length) {
args.push("-p", httpsProxyFromEnv)
}

if (isWin) {
Expand Down
2 changes: 1 addition & 1 deletion test/babel-jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function createTransformer(options) {
// console.log(`Do ${filename}`)

if (babel == null) {
babel = require('babel-core')
babel = require('@babel/core')
}

if (isFullyCompiled(src)) {
Expand Down
Loading

0 comments on commit cfec5c6

Please sign in to comment.