Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Yes, there is also a [Grunt Plugin](https://github.com/mllrsohn/grunt-node-webki
Usage: nwbuild [options] [path]

Options:
-p, --platforms Platforms to build, comma-sperated, can be: win,osx,linux32,linux64 [default: "osx,win"]
-p, --platforms Platforms to build, comma-sperated, can be: win32,win64,osx32,osx64,linux32,linux64 ['osx32', 'osx64', 'win32', 'win64']
-v, --version The nw version, eg. 0.8.4 [default: "latest"]
-r, --run Runs node-webkit for the current platform [default: false]
-o, --buildDir The build folder [default: "./build"]
Expand All @@ -44,7 +44,7 @@ Or use the module:
var NwBuilder = require('node-webkit-builder');
var nw = new NwBuilder({
files: './path/to/nwfiles/**/**', // use the glob format
platforms: ['win','osx']
platforms: ['osx32', 'osx64', 'win32', 'win64']
});

//Log stuff you want
Expand Down Expand Up @@ -85,9 +85,11 @@ The version of node-webkit you want to use. Per default it looks up the latest v

#### options.platforms
Type: `Array`
Default value: `['win', 'osx']`
Default value: `['osx32', 'osx64', 'win32', 'win64']`

The platforms you want to build. Can be `['win', 'osx', 'linux32', 'linux64']`
The platforms you want to build. Can be `['win32', 'win64', 'osx32', 'osx64', 'linux32', 'linux64']`

The values `['win', 'osx', 'linux']` can also be used and will build both the 32 and 64 bit versions of the specified platforms.

#### options.appName
Type: `String`
Expand Down Expand Up @@ -177,13 +179,33 @@ Allows you to specify platform-specific manifest values. Example manifest:
},
"platformOverrides": {
"win": {
"window": {
"toolbar": true
}
},
"win32": {
"window": {
"frame": true
"toolbar": false
}
},
"win64": {
"window": {
"frame": true
}
},
"osx": {
...
},
"osx32": {
...
},
"osx64": {
...
},
"linux": {
...
},
"linux32": {
...
},
Expand All @@ -210,6 +232,8 @@ For example, when building for Windows, the manifest generated and put into the
}
```

Additionally, when specifying multiple version of the same platform such as "win", "win32", and "win64", changes will be applied such that "win" applies to both "win32" and "win64", while "win32" and "win64" apply only to the specified version. Also note that "win32" and "win64" can further override changes made in "win".

See [#85](https://github.com/mllrsohn/node-webkit-builder/issues/85) and [#94](https://github.com/mllrsohn/node-webkit-builder/pull/94) for more information. If you need this during development too, see [platform-overrides](http://github.com/adam-lynch/platform-overrides) and [gulp-platform-overrides](http://github.com/adam-lynch/gulp-platform-overrides). There is no Grunt plugin, [yet](https://github.com/new).

## Troubleshooting
Expand Down
4 changes: 2 additions & 2 deletions bin/nwbuild
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ var argv = optimist
.usage('Usage: nwbuild [options] [path]')

.alias('p', 'platforms')
.default('p', 'osx,win')
.describe('p', 'Platforms to build, comma-sperated, can be: win,osx,linux32,linux64')
.default('p', 'osx32,osx64,win32,win64')
.describe('p', 'Platforms to build, comma-sperated, can be: win32,win64,osx32,osx64,linux32,linux64')

.alias('v', 'version')
.default('v', 'latest')
Expand Down
2 changes: 1 addition & 1 deletion example/Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gulp.task('nw', function () {
files: './nwapp/**',
macIcns: './icons/icon.icns',
macPlist: {mac_bundle_id: 'myPkg'},
platforms: ['win', 'osx']
platforms: ['win32', 'win64', 'osx32', 'osx64']
});

// Log stuff you want
Expand Down
8 changes: 4 additions & 4 deletions lib/detectCurrentPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
module.exports = function () {
switch(process.platform) {
case 'darwin':
return'osx';
return process.arch === 'x64' ? 'osx64' : 'osx32';

case 'win32':
return 'win';
return (process.arch === 'x64' || process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) ? 'win64' : 'win32';

case 'linux':
return process.arch === 'x64' ? 'linux64' : 'linux32';
}
}
}
20 changes: 16 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function NwBuilder(options) {
files: null,
appName: false,
appVersion: false,
platforms: ['win','osx'],
platforms: ['osx32', 'osx64', 'win32', 'win64'],
currentPlatform: detectCurrentPlatform(),
version: 'latest',
buildDir: './build',
Expand All @@ -40,7 +40,19 @@ function NwBuilder(options) {
winIco: null,
argv: process.argv.slice(2)
};

// Intercept the platforms and check for the legacy platforms of 'osx' and 'win' and
// replace with 'osx32', 'osx64', and 'win32', 'win64' respectively.
if(typeof options.platforms != 'undefined'){
if(options.platforms.indexOf('osx') >= 0){
options.platforms.splice(options.platforms.indexOf('osx'), 1, 'osx32', 'osx64');
}
if(options.platforms.indexOf('win') >= 0){
options.platforms.splice(options.platforms.indexOf('win'), 1, 'win32', 'win64');
}
if(options.platforms.indexOf('linux') >= 0){
options.platforms.splice(options.platforms.indexOf('linux'), 1, 'linux32', 'linux64');
}
}
// Assing options
this.options = _.defaults(options, defaults);
this._platforms = platforms;
Expand Down Expand Up @@ -344,7 +356,7 @@ NwBuilder.prototype.zipAppFiles = function () {
self._zips = {};

this._forEachPlatform(function(name, platform) {
if(name === 'osx' && self.options.macZip || platform.needsZip) {
if((name === 'osx32' || name === 'osx64') && self.options.macZip || platform.needsZip) {
_needsZip = true;
var platformSpecific = !!platform.platformSpecificManifest;

Expand Down Expand Up @@ -405,7 +417,7 @@ NwBuilder.prototype.mergeAppFiles = function () {

this._forEachPlatform(function (name, platform) {
// We copy the app files if we are on mac and don't force zip
if(name === 'osx') {
if(name === 'osx32' || name === 'osx64') {
// no zip, copy the files
if(!self.options.macZip) {
self._files.forEach(function (file) {
Expand Down
20 changes: 18 additions & 2 deletions lib/platforms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
win: {
win32: {
needsZip: true,
runable: 'nw.exe',
files: { // First file must be the executable
Expand All @@ -8,13 +8,29 @@ module.exports = {
},
versionNameTemplate: 'v${ version }/node-webkit-v${ version }-win-ia32.zip'
},
osx: {
win64: {
needsZip: true,
runable: 'nw.exe',
files: { // First file must be the executable
'<=0.9.2': ['nw.exe', 'ffmpegsumo.dll', 'icudt.dll', 'libEGL.dll', 'libGLESv2.dll', 'nw.pak', 'locales'],
'>0.9.2': ['nw.exe', 'ffmpegsumo.dll', 'icudtl.dat', 'libEGL.dll', 'libGLESv2.dll', 'nw.pak', 'locales']
},
versionNameTemplate: 'v${ version }/node-webkit-v${ version }-win-x64.zip'
},
osx32: {
runable: 'node-webkit.app/Contents/MacOS/node-webkit',
files: {
'*': ['node-webkit.app']
},
versionNameTemplate: 'v${ version }/node-webkit-v${ version }-osx-ia32.zip'
},
osx64: {
runable: 'node-webkit.app/Contents/MacOS/node-webkit',
files: {
'*': ['node-webkit.app']
},
versionNameTemplate: 'v${ version }/node-webkit-v${ version }-osx-x64.zip'
},
linux32: {
needsZip: true,
chmod: '0755',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
"temp": "~0.7.0",
"update-notifier": "^0.1.8",
"winresourcer": "^0.9.0",
"platform-overrides": "~0.3.0"
"platform-overrides": "~1.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"frame": true,
"toolbar": false
}
}
}
9 changes: 9 additions & 0 deletions test/expected/oneOveriddenRestNot/osx64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "nw-demo",
"version": "0.1.0",
"main": "index.html",
"window": {
"frame": true,
"toolbar": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"x": ["y", "z"],
"abc": 2,
"def": {}
}
}
12 changes: 12 additions & 0 deletions test/expected/platformOverrides/osx64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "nw-demo",
"version": "0.1.0",
"main": "other.html",
"window": {
"frame": false,
"toolbar": false
},
"x": ["y", "z"],
"abc": 2,
"def": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"x": ["z"],
"abc": [1],
"def": {"x":1}
}
}
12 changes: 12 additions & 0 deletions test/expected/platformOverrides/win64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "nw-demo",
"version": "0.1.0",
"main": "index.html",
"window": {
"frame": true,
"toolbar": false
},
"x": ["z"],
"abc": [1],
"def": {"x":1}
}
4 changes: 2 additions & 2 deletions test/fixtures/oneOveriddenRestNot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"toolbar": false
},
"platformOverrides": {
"osx": {
"osx32": {
"window": {
"frame": true
}
}
}
}
}
19 changes: 16 additions & 3 deletions test/fixtures/platformOverrides/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,28 @@
"abc": [],
"def": {},
"platformOverrides": {
"win": {
"win32": {
"window": {
"frame": true
},
"x": ["z"],
"abc": [1],
"def": {"x":1}
},
"osx": {
"win64": {
"window": {
"frame": true
},
"x": ["z"],
"abc": [1],
"def": {"x":1}
},
"osx32": {
"main": "other.html",
"x": ["y", "z"],
"abc": 2
},
"osx64": {
"main": "other.html",
"x": ["y", "z"],
"abc": 2
Expand All @@ -36,4 +49,4 @@
"x": []
}
}
}
}
46 changes: 24 additions & 22 deletions test/nwBuilder.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions test/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ test('getVersionNames', function (t) {
var expected = {
linux32: 'v'+v+'/node-webkit-v'+v+'-linux-ia32.tar.gz',
linux64: 'v'+v+'/node-webkit-v'+v+'-linux-x64.tar.gz',
osx: 'v'+v+'/node-webkit-v'+v+'-osx-ia32.zip',
win: 'v'+v+'/node-webkit-v'+v+'-win-ia32.zip'
osx32: 'v'+v+'/node-webkit-v'+v+'-osx-ia32.zip',
osx64: 'v'+v+'/node-webkit-v'+v+'-osx-x64.zip',
win32: 'v'+v+'/node-webkit-v'+v+'-win-ia32.zip',
win64: 'v'+v+'/node-webkit-v'+v+'-win-x64.zip',

};

var names = versions.getVersionNames(v);
Expand Down