Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6e9b7d6
Always use node-pre-gyp for building.
joshaber Nov 11, 2015
0f37197
Pass the runtime through to node-pre-gyp.
joshaber Nov 11, 2015
35458a9
Try getting the nwjs and electron versions from the environment.
joshaber Nov 11, 2015
f5688c5
Try some electron and nwjs builds too.
joshaber Nov 11, 2015
e60dfc6
Merge remote-tracking branch 'nodegit/master' into build-more-binaries
joshaber Nov 11, 2015
0b38fcb
Export the node version as well.
joshaber Nov 11, 2015
859fe54
Send package through our install script.
joshaber Nov 11, 2015
895a03f
Let's give Windows a shot.
joshaber Nov 11, 2015
504a38f
Use 0.12 with nwjs?
joshaber Nov 11, 2015
3341cb8
Stop building nwjs for now.
joshaber Nov 11, 2015
0aea99a
Separate our concerns better.
joshaber Nov 11, 2015
d5aac73
Give appveyor a kick.
joshaber Nov 11, 2015
8748047
Wrap publish too.
joshaber Nov 12, 2015
4d4f6fe
Test
joshaber Nov 12, 2015
c00f1e5
Update the distUrl?
joshaber Nov 12, 2015
57a1a1b
Let's try using electron to run the tests.
joshaber Nov 12, 2015
9a8d465
I dunno
joshaber Nov 12, 2015
42bfccb
Back to fast_finish.
joshaber Nov 12, 2015
62bd2a8
Try using the local electron.
joshaber Nov 12, 2015
4b66054
Revert "Try using the local electron."
joshaber Nov 12, 2015
0c6f49c
Set the path?
joshaber Nov 12, 2015
6a713b8
Muck around with the PATH some more.
joshaber Nov 12, 2015
ffa4721
Try using Chocolately instead of npm install.
joshaber Nov 12, 2015
9380bee
Fix electron tests on windows
johnhaley81 Nov 12, 2015
6f8ed01
Revert "Try using Chocolately instead of npm install."
joshaber Nov 12, 2015
dc27e10
Back to installing locally.
joshaber Nov 12, 2015
a6c540f
Try inheriting stdout and stderr.
joshaber Nov 12, 2015
9d172ec
Try writing directly.
joshaber Nov 12, 2015
01fb1da
try letting appveyor run the tests without shelling around to cmd twice.
maxkorp Nov 12, 2015
d2e91cc
global install again, using the .cmd
maxkorp Nov 12, 2015
ff990cb
Not now, linter
maxkorp Nov 12, 2015
3589f50
only use the .cmd on windows
maxkorp Nov 12, 2015
cadc12c
revert breaking the tests
maxkorp Nov 12, 2015
6f6ce10
Gimme ur logs.
joshaber Nov 12, 2015
bf03289
Revert "Gimme ur logs."
joshaber Nov 12, 2015
fd80a6b
Add failing test to confirm that failures on CI
johnhaley81 Nov 12, 2015
26f1755
Fail harder.
joshaber Nov 12, 2015
7e1b088
Revert "Add failing test to confirm that failures on CI"
joshaber Nov 12, 2015
8e4b314
Don't need the cmd: prefix.
joshaber Nov 12, 2015
23dd908
Enable segfault handling on tests
Nov 13, 2015
72fa2d0
Only install electron-prebuilt if we're building for electron.
joshaber Nov 13, 2015
b2e1110
Merge remote-tracking branch 'origin/build-more-binaries' into build-…
joshaber Nov 13, 2015
789cfa5
Do it in script, I guess.
joshaber Nov 13, 2015
a1eec92
Gotta do it before testing of course.
joshaber Nov 13, 2015
2752191
Just use the name.
joshaber Nov 13, 2015
5f7b94d
Stop fast finishing for now.
joshaber Nov 13, 2015
0b3cd2f
Fine, stop conditionalizing it on appveyor.
joshaber Nov 13, 2015
08550a8
...and fast_finish is back.
joshaber Nov 13, 2015
62c0069
Copy process.env.
joshaber Nov 13, 2015
e5d1fd6
Don't use electron to run tests on Linux.
joshaber Nov 13, 2015
010f75c
Revert "Fine, stop conditionalizing it on appveyor."
joshaber Nov 13, 2015
bb0149f
Revert "Merge remote-tracking branch 'origin/build-more-binaries' int…
joshaber Nov 13, 2015
09a970e
Polyfill object-assign.
joshaber Nov 13, 2015
6dc86e8
Use lodash.assign instead.
joshaber Nov 13, 2015
a23acfc
Errrryone's gonna need this.
joshaber Nov 13, 2015
fac0980
Lemme see some more failures.
joshaber Nov 13, 2015
91381c9
Increase some timeouts.
joshaber Nov 13, 2015
fbea131
Centralize finding node-pre-gyp.
joshaber Nov 13, 2015
d5fb49e
Build electron versions on node 4.2.
joshaber Nov 13, 2015
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
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
- export NODE_VERSION="0.12"
- export NODE_VERSION="4.1"
- export NODE_VERSION="5.0"
- export ELECTRON_VERSION="0.34.3" NODE_VERSION="4.2"
matrix:
fast_finish: true
before_install:
Expand Down Expand Up @@ -48,6 +49,9 @@ os:
- linux
- osx
script:
- if [ -n "$ELECTRON_VERSION" ]; then
npm install electron-prebuilt@$ELECTRON_VERSION;
fi
- if [ $TRAVIS_OS_NAME == "linux" ] && [ $NODE_VERSION == "0.12" ]; then
npm test && npm run cov && npm run coveralls;
else
Expand All @@ -58,8 +62,8 @@ after_success:
npm install -g node-pre-gyp
npm install -g aws-sdk
node lifecycleScripts/clean
node-pre-gyp package
node-pre-gyp publish
node lifecycleScripts/package
node lifecycleScripts/publish
fi
notifications:
slack:
Expand Down
13 changes: 8 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,26 @@ environment:
GIT_SSH: c:\projects\nodegit\vendor\plink.exe
GYP_MSVS_VERSION: 2013
matrix:
# Electron
- nodejs_version: "4.2"
ELECTRON_VERSION: "0.34.3"
# Node.js
- nodejs_version: "0.12"
# Node.js
- nodejs_version: "4.1"
- nodejs_version: "5.0"

matrix:
fast_finish: true
fast_finish: false

# Get the latest stable version of Node 0.STABLE.latest
install:
- ps: Install-Product node $env:nodejs_version
- ps: Start-Process c:\projects\nodegit\vendor\pageant.exe c:\projects\nodegit\vendor\private.ppk
- cmd: npm install -g node-gyp
- npm install
- cmd: npm install

test_script:
- IF DEFINED ELECTRON_VERSION npm install electron-prebuilt@%ELECTRON_VERSION%
- node --version
- npm --version
- cmd: npm test
Expand All @@ -52,8 +55,8 @@ on_success:
- IF %APPVEYOR_REPO_TAG%==true npm install -g node-pre-gyp
- IF %APPVEYOR_REPO_TAG%==true npm install -g aws-sdk
- IF %APPVEYOR_REPO_TAG%==true node lifecycleScripts\clean
- IF %APPVEYOR_REPO_TAG%==true node-pre-gyp package
- IF %APPVEYOR_REPO_TAG%==true node-pre-gyp publish
- IF %APPVEYOR_REPO_TAG%==true node lifecycleScripts\package
- IF %APPVEYOR_REPO_TAG%==true node lifecycleScripts\publish

build: off

Expand Down
32 changes: 32 additions & 0 deletions lifecycleScripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var path = require("path");
var objectAssign = require("lodash.assign");

var exec = require("./exec");
var findNodePreGyp = require("./findNodePreGyp");

module.exports = function build(action, targetInfo) {
var opts = {
cwd: ".",
maxBuffer: Number.MAX_VALUE,
env: objectAssign({}, process.env)
};

var debug = (process.env.BUILD_DEBUG ? " --debug" : "");
var distUrl = "";

if (targetInfo.target === "electron") {
var home = process.platform == "win32" ?
process.env.USERPROFILE : process.env.HOME;
opts.env.HOME = path.join(home, ".electron-gyp");

distUrl = "--dist-url=https://atom.io/download/atom-shell";
}

var npg = findNodePreGyp();
var cmd = [npg, action, debug, distUrl, "--build-from-source"]
.concat(targetInfo.args)
.join(" ")
.trim();

return exec(cmd, opts);
};
25 changes: 25 additions & 0 deletions lifecycleScripts/determineTarget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var whichNativeNodish = require("which-native-nodish");

module.exports = function determineTarget(action) {
return whichNativeNodish("..")
.then(function(results) {
var nwVersion = results.nwVersion || process.env.NWJS_VERSION || null;
var asVersion = results.asVersion || process.env.ELECTRON_VERSION || null;
var args = [];
var target = null;
if (nwVersion) {
target = "node-webkit";
args.push("--target=" + nwVersion);
} else if (asVersion) {
target = "electron";
args.push("--target=" + asVersion);
}

if (target) {
args.push("--runtime=" + target);
}

target = target || "node";
return {target: target, args: args};
});
};
5 changes: 5 additions & 0 deletions lifecycleScripts/exec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var promisify = require("promisify-node");

module.exports = promisify(function(command, opts, callback) {
return require("child_process").exec(command, opts, callback);
});
6 changes: 6 additions & 0 deletions lifecycleScripts/findNodePreGyp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var path = require("path");

module.exports = function findNodePreGyp() {
var npg = path.resolve(".", "node_modules", ".bin", "node-pre-gyp");
return npg.replace(/\s/g, "\\$&");
};
119 changes: 31 additions & 88 deletions lifecycleScripts/install.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,44 @@
var promisify = require("promisify-node");
var path = require("path");
var fs = require("fs");
var path = require("path");

var whichNativeNodish = require("which-native-nodish");
var determineTarget = require("./determineTarget");
var prepareForBuild = require("./prepareForBuild");

var exec = promisify(function(command, opts, callback) {
return require("child_process").exec(command, opts, callback);
});
var nwVersion = null;
var asVersion = null;
var build = require("./build");
var exec = require("./exec");

var local = path.join.bind(path, __dirname);

return whichNativeNodish("..")
.then(function(results) {
nwVersion = results.nwVersion;
asVersion = results.asVersion;
})
.then(function() {
var buildAction = "rebuild";

return determineTarget()
.then(function(targetInfo) {
if (fs.existsSync(local("../.didntcomefromthenpmregistry"))) {
return prepareAndBuild();
return prepareAndBuild(buildAction, targetInfo);
}
if (process.env.BUILD_DEBUG) {
console.info("[nodegit] Doing a debug build, no fetching allowed.");
return prepareAndBuild();
return prepareAndBuild(buildAction, targetInfo);
}
if (process.env.BUILD_ONLY) {
console.info("[nodegit] BUILD_ONLY is set to true, no fetching allowed.");
return prepareAndBuild();
}
var args = [];
if (asVersion) {
args.push("--runtime=electron");
args.push("--target=" + asVersion);
} else if (nwVersion) {
args.push("--runtime=node-webkit");
args.push("--target=" + nwVersion);
return prepareAndBuild(buildAction, targetInfo);
}
return installPrebuilt(args);
return installPrebuilt(targetInfo);
})
.then(function() {
console.info("[nodegit] Compilation complete.");
console.info("[nodegit] Completed installation successfully.");
process.exitCode = 0;
},
function(err, stderr) {
console.error(err);
console.error(stderr);
process.exitCode = 13;
});

function installPrebuilt(args) {
function installPrebuilt(targetInfo) {
console.info("[nodegit] Fetching binary from S3.");
var installArguments = args.join(" ");
var installArguments = targetInfo.args.join(" ");
return exec("node-pre-gyp install " + installArguments)
.then(
function() {
Expand All @@ -53,71 +48,19 @@ function installPrebuilt(args) {
console.info("[nodegit] Failed to install prebuilt binary, " +
"building manually.");
console.error(err);
return prepareAndBuild();
return prepareAndBuild(buildAction, targetInfo);
}
);
}


function prepareAndBuild() {
function prepareAndBuild(action, targetInfo) {
console.info("[nodegit] Regenerating and configuring code");
return prepareForBuild()
.then(function() {
return build();
console.info("[nodegit] Everything is ready to go, " +
"attempting compilation.");
console.info("[nodegit] Building native " +
targetInfo.target + " module.");
return build(buildAction, targetInfo);
});
}

function build() {
console.info("[nodegit] Everything is ready to go, attempting compilation");
if (nwVersion) {
console.info("[nodegit] Building native node-webkit module.");
}
else {
console.info("[nodegit] Building native node module.");
}

var opts = {
cwd: ".",
maxBuffer: Number.MAX_VALUE,
env: process.env
};

var target = "";
var debug = (process.env.BUILD_DEBUG ? " --debug" : "");
var builder = "node-gyp";
var distUrl = "";

if (asVersion) {
var home = process.platform == "win32" ?
process.env.USERPROFILE : process.env.HOME;

opts.env.HOME = path.join(home, ".atom-shell-gyp");

target = "--target=" + asVersion;

distUrl = "--dist-url=https://gh-contractor-zcbenz.s3." +
"amazonaws.com/atom-shell/dist";
}
else if (nwVersion) {
builder = "nw-gyp";
target = "--target=" + nwVersion;
}

builder = path.resolve(".", "node_modules", ".bin", builder);
builder = builder.replace(/\s/g, "\\$&");
var cmd = [builder, "rebuild", target, debug, distUrl]
.join(" ").trim();

return exec(cmd, opts)
.then(function() {
console.info("[nodegit] Compilation complete.");
console.info("[nodegit] Completed installation successfully.");
process.exitCode = 0;
},
function(err, stderr) {
console.error(err);
console.error(stderr);
process.exitCode = 13;
}
);
}
19 changes: 19 additions & 0 deletions lifecycleScripts/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var determineTarget = require("./determineTarget");
var build = require("./build");

return determineTarget()
.then(function(targetInfo) {
console.info("[nodegit] Packaging native " +
targetInfo.target + " module.");
return build("package", targetInfo);
})
.then(function() {
console.info("[nodegit] Packaging complete.");
console.info("[nodegit] Completed packaging successfully.");
process.exitCode = 0;
},
function(err, stderr) {
console.error(err);
console.error(stderr);
process.exitCode = 13;
});
20 changes: 20 additions & 0 deletions lifecycleScripts/publish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var exec = require("./exec");
var determineTarget = require("./determineTarget");
var findNodePreGyp = require("./findNodePreGyp");

return determineTarget()
.then(function(targetInfo) {
var npg = findNodePreGyp();
console.info("[nodegit] Publishing native " +
targetInfo.target + " module.");
return exec(npg + " publish " + targetInfo.args);
})
.then(function() {
console.info("[nodegit] Publishing completed successfully.");
process.exitCode = 0;
},
function(err, stderr) {
console.error(err);
console.error(stderr);
process.exitCode = 13;
});
41 changes: 41 additions & 0 deletions lifecycleScripts/runTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var spawn = require("child_process").spawn;
var Promise = require("nodegit-promise");
var path = require("path");
var objectAssign = require("lodash.assign");

var determineTarget = require("./determineTarget");

return determineTarget()
.then(function(targetInfo) {
var opts = {
cwd: ".",
maxBuffer: Number.MAX_VALUE,
env: objectAssign({}, process.env),
stdio: "inherit",
stderr: "inherit",
};
var binaryName = "node";
var args = ["--expose-gc", "test"];

if (targetInfo.target === "electron" && process.platform !== "linux") {
binaryName = path.resolve("node_modules", ".bin", "electron");

if (process.platform === "win32") {
binaryName += ".cmd";
}

opts.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE = "1";
}

return new Promise(function(resolve, reject) {
var task = spawn(binaryName, args, opts);
task.on("exit", function(code) {
if (code === 0) {
resolve();
} else {
reject(code);
}
process.exit(code);
});
});
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
],
"dependencies": {
"fs-extra": "^0.24.0",
"lodash.assign": "^3.2.0",
"node-pre-gyp": "^0.6.15",
"nodegit-promise": "^3.0.3",
"npm": "^3.3.3",
Expand Down Expand Up @@ -82,7 +83,7 @@
"cov": "npm run cppcov && npm run filtercov && npm run mergecov",
"mocha": "mocha test/runner test/tests",
"mochaDebug": "mocha --debug-brk test/runner test/tests",
"test": "npm run lint && node --expose-gc test",
"test": "npm run lint && node lifecycleScripts/runTests",
"generateJson": "node generate/scripts/generateJson",
"generateNativeCode": "node generate/scripts/generateNativeCode",
"generateMissingTests": "node generate/scripts/generateMissingTests",
Expand Down
Loading