node-pre-gyp
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -10,2 +10,3 @@ | ||
function build(gyp, argv, callback) { | ||
var node_gyp_command = argv.length && argv[0] == 'rebuild' ? argv[0] : 'build'; | ||
var package_json = JSON.parse(fs.readFileSync('./package.json')); | ||
@@ -16,3 +17,3 @@ // options look different depending on whether node-pre-gyp is called directly | ||
command_line_opts = command_line_opts.filter(function(opt) { return opt.length > 2 && opt.slice(0,2) == '--'}); | ||
var node_gyp_args = ['rebuild'].concat(command_line_opts); | ||
var node_gyp_args = [node_gyp_command].concat(command_line_opts); | ||
compile.run_gyp(node_gyp_args,gyp.opts,function(err,opts) { | ||
@@ -19,0 +20,0 @@ return callback(err); |
@@ -106,3 +106,3 @@ | ||
function do_build(gyp,argv,callback) { | ||
gyp.todo.push( { name: 'build', args: [] } ); | ||
gyp.todo.push( { name: 'build', args: ['rebuild'] } ); | ||
process.nextTick(callback); | ||
@@ -128,9 +128,27 @@ } | ||
if (found) { | ||
console.log('['+package_json.name+'] Success: "' + binary_module + '" already installed'); | ||
console.log('Run pass --build-from-source to compile'); | ||
return callback(); | ||
test_binary.validate(opts,function(err) { | ||
if (err) { | ||
console.error(err.message); | ||
log.error("Testing local pre-built binary failed, attempting to re-download"); | ||
place_binary(from,to,opts,function(err) { | ||
if (err && fallback_to_build) { | ||
log.info('build','source compile required'); | ||
return do_build(gyp,argv,callback); | ||
} else if (err) { | ||
return callback(err); | ||
} else { | ||
console.log('['+package_json.name+'] Success: "' + binary_module + '" is installed'); | ||
return callback(); | ||
} | ||
}); | ||
} else { | ||
console.log('['+package_json.name+'] Success: "' + binary_module + '" already installed'); | ||
console.log('Run pass --build-from-source to compile'); | ||
return callback(); | ||
} | ||
}); | ||
} else { | ||
place_binary(from,to,opts,function(err) { | ||
if (err && fallback_to_build) { | ||
log.info('build','source compile required'); | ||
log.error('Source compile required: ' + err.message); | ||
return do_build(gyp,argv,callback); | ||
@@ -142,3 +160,4 @@ } else if (err) { | ||
if (err && fallback_to_build) { | ||
log.info("Testing pre-built binary failed, falling back to source compile: ("+err.message+")"); | ||
console.error(err.message); | ||
log.error("Testing pre-built binary failed, attempting to re-download"); | ||
return do_build(gyp,argv,callback); | ||
@@ -145,0 +164,0 @@ } else if (err) { |
@@ -9,5 +9,5 @@ | ||
{ name: 'clean', args: [] } | ||
, { name: 'build', args: [] } | ||
, { name: 'build', args: ['rebuild'] } | ||
) | ||
process.nextTick(callback) | ||
} |
@@ -34,2 +34,3 @@ | ||
args.push(opts.module_main); | ||
log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ')); | ||
cp.execFile(shell_cmd, args, function(err, stdout, stderr) { | ||
@@ -36,0 +37,0 @@ if (err || stderr) { |
{ | ||
"name": "node-pre-gyp", | ||
"description": "Node.js native addon binary install tool", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "native", |
@@ -0,3 +1,7 @@ | ||
var path = require('path'); | ||
var pkg = require('./package.json'); | ||
var assert = require('assert'); | ||
var app1 = require('./build/Release/app1.node'); | ||
assert.ok(app1); | ||
var binding = './' + path.join(pkg.binary.module_path,pkg.binary.module_name + '.node'); | ||
var app = require(binding); | ||
assert.ok(app); |
@@ -0,3 +1,7 @@ | ||
var path = require('path'); | ||
var pkg = require('./package.json'); | ||
var assert = require('assert'); | ||
var app2 = require('./lib/app2.node'); | ||
assert.ok(app2); | ||
var binding = './' + path.join(pkg.binary.module_path,pkg.binary.module_name + '.node'); | ||
var app = require(binding); | ||
assert.ok(app); |
@@ -0,3 +1,8 @@ | ||
var path = require('path'); | ||
var pkg = require('./package.json'); | ||
var assert = require('assert'); | ||
var app3 = require('./lib/app3.node'); | ||
assert.equal(app3.hello(),"hello"); | ||
var binding = './' + path.join(pkg.binary.module_path,pkg.binary.module_name + '.node'); | ||
var app = require(binding); | ||
assert.ok(app); | ||
assert.equal(app.hello(),"hello"); |
# Test app | ||
Demostrates an example node c++ app that depends on an external static library. | ||
Because the external `mylib.a` library is statically built and linked it will be available inside the `app3.node` binary. See the `app4` example for how to handle | ||
shared libraries.# Test app | ||
Demostrates an example node c++ app that depends on an external library. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 3 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70969
49
627
4
21
11