Skip to content

Commit

Permalink
Implement support for package.json tessel.skipBinary = true. Fixes gh…
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Feb 17, 2016
1 parent 36b9f39 commit 9e38843
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ module.exports = function(grunt) {
src: [
'test/**/*.js',
'!test/unit/fixtures/syntax-error/**/*.js',
'!test/unit/fixtures/project-binary-modules/**/*'
'!test/unit/fixtures/project-binary-modules/**/*',
'!test/unit/fixtures/project-skip-binary/**/*',
]
}
},
Expand All @@ -38,6 +39,7 @@ module.exports = function(grunt) {
'Gruntfile.js',
'!test/unit/fixtures/syntax-error/**/*.js',
'!test/unit/fixtures/project-binary-modules/**/*',
'!test/unit/fixtures/project-skip-binary/**/*',
],
options: {
config: '.jscsrc'
Expand Down
6 changes: 6 additions & 0 deletions lib/tessel/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ actions.resolveBinaryModules = function(opts) {
return 'Release';
}());

// If the compiled module doesn't actually need a binary.node
// injected into the bundle, then there is nothing to do.
if (packageJson.tessel && packageJson.tessel.skipBinary) {
return bins;
}

if (buildType !== 'Release' && buildType !== 'Debug') {
buildType = 'Release';
}
Expand Down
38 changes: 38 additions & 0 deletions test/unit/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,44 @@ exports['deploy.resolveBinaryModules'] = {
done();
},

bailOnSkipBinary: function(test) {
test.expect(2);

this.target = path.normalize('test/unit/fixtures/project-skip-binary');

this.relative.restore();
this.relative = sandbox.stub(path, 'relative', () => {
return path.join(__dirname, '/../../test/unit/fixtures/project-skip-binary/');
});

// We WANT to read the actual gyp files if necessary
this.readGypFileSync.restore();

// We WANT to glob the actual target directory
this.globSync.restore();

this.exists = sandbox.stub(fs, 'existsSync', () => true);

deploy.resolveBinaryModules({
target: this.target
}).then(() => {

test.equal(this.exists.callCount, 1);
// test/unit/fixtures/skip-binary/ has the corresponding
// dependencies for the following binary modules:
//
// debug-1.1.1-Debug
// release-1.1.1-Release
//
// However, the latter has a "tessel.skipBinary = true" key in its package.json
//
//
test.equal(this.exists.lastCall.args[0].endsWith(path.normalize('.tessel/binaries/debug-1.1.1-Debug')), true);

test.done();
}).catch((error) => test.fail(error));
},

findsModulesMissingBinaryNodeFiles: function(test) {
test.expect(2);

Expand Down
Empty file.
3 changes: 3 additions & 0 deletions test/unit/fixtures/project-skip-binary/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var path = require('path');
var fs = require('fs');
var release = require('release');

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions test/unit/fixtures/project-skip-binary/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "project-skip-binary",
"version": "0.0.1",
"description": "project-skip-binary",
"main": "index.js",
"dependencies": {
"release": "1.1.1"
}
}

0 comments on commit 9e38843

Please sign in to comment.