-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Enable install and build using node-chakracore #1777
Changes from 9 commits
eec8afa
4819b82
5d8ef9f
7924ebc
358b01b
e1b536b
c7124bb
6785d4d
8db7ad7
d39e552
d19aa55
5021dff
4077615
e334f71
a602a0b
15983e9
8591db4
e00e5bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,44 +32,53 @@ | |
- '%AppData%\npm-cache' | ||
|
||
environment: | ||
# https://github.com/jasongin/nvs/blob/master/doc/CI.md | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be worth looking at https://github.com/appveyor/ci/blob/master/scripts/nodejs-utils.psm1 to get "native" support for Chakra on Appveyor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is definitely an option (and likewise in |
||
NVS_VERSION: 1.3.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you bump this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, forgot to update it. |
||
SKIP_SASS_BINARY_DOWNLOAD_FOR_CI: true | ||
matrix: | ||
- nodejs_version: 0.10 | ||
GYP_MSVS_VERSION: 2013 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||
- nodejs_version: 0.12 | ||
- NODEJS_VERSION: node/0.10 | ||
GYP_MSVS_VERSION: 2013 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||
- nodejs_version: 1.0 | ||
- NODEJS_VERSION: node/0.12 | ||
GYP_MSVS_VERSION: 2013 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||
- nodejs_version: 1 | ||
- NODEJS_VERSION: iojs/1 | ||
GYP_MSVS_VERSION: 2013 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||
- nodejs_version: 2 | ||
- NODEJS_VERSION: iojs/2 | ||
GYP_MSVS_VERSION: 2013 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||
- nodejs_version: 3 | ||
- NODEJS_VERSION: iojs/3 | ||
GYP_MSVS_VERSION: 2013 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||
- nodejs_version: 4 | ||
- NODEJS_VERSION: node/4 | ||
GYP_MSVS_VERSION: 2013 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||
- nodejs_version: 5 | ||
- NODEJS_VERSION: node/5 | ||
GYP_MSVS_VERSION: 2013 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 | ||
- nodejs_version: 6 | ||
- NODEJS_VERSION: node/6 | ||
GYP_MSVS_VERSION: 2015 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
- nodejs_version: 7 | ||
- NODEJS_VERSION: node/7 | ||
GYP_MSVS_VERSION: 2015 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
- nodejs_version: 8 | ||
- NODEJS_VERSION: node/8 | ||
GYP_MSVS_VERSION: 2015 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
- NODEJS_VERSION: chakracore/latest | ||
GYP_MSVS_VERSION: 2015 | ||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 | ||
|
||
install: | ||
- ps: Install-Product node $env:nodejs_version $env:platform | ||
# Install NVS | ||
- git clone --branch v%NVS_VERSION% --depth 1 https://github.com/jasongin/nvs %LOCALAPPDATA%\nvs | ||
- set PATH=%LOCALAPPDATA%\nvs;%PATH% | ||
- nvs --version | ||
# Install selected version of Node.js using NVS | ||
- nvs add %NODEJS_VERSION% | ||
- nvs use %NODEJS_VERSION% | ||
|
||
- node --version | ||
- npm --version | ||
- npm install | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,14 +56,20 @@ function afterBuild(options) { | |
*/ | ||
|
||
function build(options) { | ||
var args = [require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')), 'rebuild', '--verbose'].concat( | ||
['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) { | ||
return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join(''); | ||
})).concat(options.args); | ||
|
||
console.log('Building:', [process.execPath].concat(args).join(' ')); | ||
|
||
var proc = spawn(process.execPath, args, { | ||
var nodeGyp = resolveNodeGyp(); | ||
var nodeGypArgs = nodeGyp.args.concat([ | ||
'rebuild', | ||
'--verbose', | ||
'--libsass_ext=' + (process.env['LIBSASS_EXT'] || ''), | ||
'--libsass_cflags=' + (process.env['LIBSASS_CFLAGS'] || ''), | ||
'--libsass_ldflags=' + (process.env['LIBSASS_LDFLAGS'] || ''), | ||
'--libsass_library=' + (process.env['LIBSASS_LIBRARY'] || ''), | ||
]) | ||
.concat(options.args); | ||
|
||
console.log(['Building:', nodeGyp.exeName].concat(nodeGypArgs).join(' ')); | ||
|
||
var proc = spawn(nodeGyp.exeName, nodeGypArgs, { | ||
stdio: [0, 1, 2] | ||
}); | ||
|
||
|
@@ -83,6 +89,40 @@ function build(options) { | |
}); | ||
} | ||
|
||
/** | ||
* Resolve node-gyp command to invoke | ||
* | ||
* @api private | ||
*/ | ||
function resolveNodeGyp() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need this now that the version is bumped to 3.6? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No and that's why i removed my changes in 5021dff . I just kept the resolution of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 that makes sense |
||
if (process.jsEngine === 'chakracore') { | ||
// For node-chakracore, check if node-gyp is in the path. | ||
// If yes, use it instead of using node-gyp directly from | ||
// node_modules because the one in node_modules is not | ||
// compatible with node-chakracore. | ||
var nodePath = path.dirname(process.execPath); | ||
var nodeGypName = process.platform === 'win32' ? 'node-gyp.cmd' : 'node-gyp'; | ||
var globalNodeGypBin = process.env.Path.split(';').filter(function(envPath) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this correct for non-Windows? what is the difference between chakraized node-gyp and the normal one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
good catch @saper . I have updated it with appropriate delim.
See nodejs/node-gyp#873 for more details and the description of my first commit. In short, the changes are to add engine specific libs and headers while compiling native modules. Since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have node-gyp as a dependency in our package.json to get around these exact issues. You could bump that dependency to the minimum safe version. |
||
return envPath.startsWith(nodePath) && | ||
envPath.endsWith('node-gyp-bin') && | ||
fs.existsSync(path.resolve(envPath, nodeGypName)); | ||
}); | ||
|
||
if (globalNodeGypBin.length !== 0) { | ||
return { exeName: 'node-gyp', args: [] }; | ||
} | ||
|
||
console.error('node-gyp incompatible with node-chakracore! Please use node-gyp installed with node-chakracore.'); | ||
process.exit(1); | ||
} | ||
|
||
var localNodeGypBin = require.resolve(path.join('node-gyp', 'bin', 'node-gyp.js')); | ||
|
||
return { | ||
exeName: process.execPath, | ||
args: [localNodeGypBin], | ||
}; | ||
} | ||
/** | ||
* Parse arguments | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the latest node current release i.e. v8.1.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure what is picked by default when you specify
node_js
value tonode
. I will update it to8
and nvs should pick the right version.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default the
node
is the latest stable, currently 8.1.2. We'd want the equivalent tonode/latest