Skip to content

Commit

Permalink
fix(publish): cache publishers based on the target name (#1958)
Browse files Browse the repository at this point in the history
Publishers are currently cached by the publisher provider (e.g.
"bintray") and by the platform name (e.g. "linux"). This means that if
the user has different publish configurations for targets that belong to
the same OS (e.g. deb and rpm), then one will override the other on the
cache.

Close: #1951
  • Loading branch information
jviotti authored and develar committed Aug 18, 2017
1 parent f1f82d0 commit 5e20529
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/electron-builder/src/publish/PublishManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class PublishManager implements PublishContext {
break
}

const publisher = this.getOrCreatePublisher(publishConfig, packager)
const publisher = this.getOrCreatePublisher(publishConfig, packager, event.target)
if (publisher == null) {
debug(`${eventFile} is not published: publisher is null, ${safeStringifyJson(publishConfig)}`)
continue
Expand All @@ -158,8 +158,12 @@ export class PublishManager implements PublishContext {
}
}

private getOrCreatePublisher(publishConfig: PublishConfiguration, platformPackager: PlatformPackager<any>): Publisher | null {
const providerCacheKey = `${publishConfig.provider}-${platformPackager.platform.name}`
private getOrCreatePublisher(publishConfig: PublishConfiguration, platformPackager: PlatformPackager<any>, target: Target | null): Publisher | null {
let providerCacheKey = `${publishConfig.provider}-${platformPackager.platform.name}`
if (target) {
providerCacheKey += `-${target.name}`
}

let publisher = this.nameToPublisher.get(providerCacheKey)
if (publisher == null) {
publisher = createPublisher(this, platformPackager.info.metadata.version!, publishConfig, this.publishOptions)
Expand Down

0 comments on commit 5e20529

Please sign in to comment.