Skip to content

Commit

Permalink
Default build version to app version on Windows (#501)
Browse files Browse the repository at this point in the history
Fixes #498.
  • Loading branch information
kevinsawicki authored and malept committed Sep 30, 2016
1 parent 1d3ba3e commit cca4601
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* `.o` and `.obj` files are ignored by default (#491)
* Electron downloads are now checked against their published checksums (#493)
* Documentation for `download.quiet` option to enable/disable progress bar (#494)
* The `build-version` property, when unspecified, now defaults to the
`app-version` property value on Windows (#501)

## [8.0.0] - 2016-09-03

Expand Down
21 changes: 19 additions & 2 deletions test/win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,31 @@ function setFileVersionTest (buildVersion) {
'build-version': buildVersion
}

return generateVersionStringTest('FileVersion', opts, buildVersion, 'File version should match build version')
return generateVersionStringTest(['ProductVersion', 'FileVersion'],
opts,
['4.99.101.0', buildVersion],
['Product version should match package.json version',
'File version should match build version'])
}

function setProductVersionTest (appVersion) {
var opts = {
'app-version': appVersion
}

return generateVersionStringTest('ProductVersion', opts, appVersion, 'Product version should match app version')
return generateVersionStringTest(['ProductVersion', 'FileVersion'],
opts,
[appVersion, appVersion],
['Product version should match app version',
'File version should match app version'])
}

function defaultProductAndFileVersionToPackageVersionTest () {
return generateVersionStringTest(['ProductVersion', 'FileVersion'],
{},
['4.99.101.0', '4.99.101.0'],
['Product version should match package.json version',
'File version should match package.json version'])
}

function setCopyrightTest (appCopyright) {
Expand Down Expand Up @@ -155,6 +171,7 @@ util.packagerTest('win32 executable name is based on sanitized app name', (t) =>

util.packagerTest('win32 build version sets FileVersion test', setFileVersionTest('2.3.4.5'))
util.packagerTest('win32 app version sets ProductVersion test', setProductVersionTest('5.4.3.2'))
util.packagerTest('win32 app/build versions default to package.json version test', defaultProductAndFileVersionToPackageVersionTest())
util.packagerTest('win32 app copyright sets LegalCopyright test', setCopyrightTest('Copyright Bar'))
util.packagerTest('win32 set LegalCopyright and CompanyName test', setCopyrightAndCompanyNameTest('Copyright Bar', 'MyCompany LLC'))
util.packagerTest('win32 set CompanyName test (win32metadata)', setCompanyNameTest('MyCompany LLC', 'win32metadata'))
Expand Down
8 changes: 4 additions & 4 deletions win32.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ module.exports = {

var rcOpts = {'version-string': win32metadata}

if (opts['build-version']) {
rcOpts['file-version'] = opts['build-version']
if (opts['app-version']) {
rcOpts['product-version'] = rcOpts['file-version'] = opts['app-version']
}

if (opts['app-version']) {
rcOpts['product-version'] = opts['app-version']
if (opts['build-version']) {
rcOpts['file-version'] = opts['build-version']
}

if (opts['app-copyright']) {
Expand Down

0 comments on commit cca4601

Please sign in to comment.