Skip to content

Commit

Permalink
fix(windows): disable feature "sign dlls" by default
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Jul 11, 2018
1 parent 5503cee commit f474ecb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions packages/electron-builder-lib/src/options/winOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ export interface WindowsConfiguration extends PlatformSpecificBuildOptions {
*/
readonly signAndEditExecutable?: boolean

/**
* Whether to sign DLL files. Advanced option.
* @see https://github.com/electron-userland/electron-builder/issues/3101#issuecomment-404212384
* @default false
*/
readonly signDlls?: boolean

/**
* The electron-updater compatibility semver range. e.g. `>= 2.16`, `>=1.0.0`. Defaults to `>=1.0.0`
*
Expand Down
8 changes: 6 additions & 2 deletions packages/electron-builder-lib/src/winPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,17 @@ export class WinPackager extends PlatformPackager<WindowsConfiguration> {
}
}

private isSignDlls(): boolean {
return this.platformSpecificBuildOptions.signDlls === true
}

protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null {
if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {
return null
}

return file => {
if (file.endsWith(".exe") || file.endsWith(".dll")) {
if (file.endsWith(".exe") || (this.isSignDlls() && file.endsWith(".dll"))) {
const parentDir = path.dirname(file)
if (parentDir !== packContext.appOutDir) {
return new CopyFileTransformer(file => this.sign(file))
Expand All @@ -366,7 +370,7 @@ export class WinPackager extends PlatformPackager<WindowsConfiguration> {
if (file === exeFileName) {
return this.signAndEditResources(path.join(packContext.appOutDir, exeFileName), packContext.arch, packContext.outDir, path.basename(exeFileName, ".exe"), this.platformSpecificBuildOptions.requestedExecutionLevel)
}
else if (file.endsWith(".exe") || file.endsWith(".dll")) {
else if (file.endsWith(".exe") || (this.isSignDlls() && file.endsWith(".dll"))) {
return this.sign(path.join(packContext.appOutDir, file))
}
return null
Expand Down

0 comments on commit f474ecb

Please sign in to comment.