Permalink
Browse files

Cleanup build scripts, lint c++ files, strip binary for smaller size

  • Loading branch information...
1 parent 5c7ade6 commit e27fd4ac45efeb09a55824b32f4fe12889b77cab Eric Pearson committed with nukulb May 14, 2012
View
@@ -41,7 +41,7 @@ task('test', [], function () {
desc("runs jshint + csslint - jake lint [path1] [path2]");
task('lint', [], function () {
- require('./build/lint')(complete, Array.prototype.slice.call(arguments));
+ require('./build/lint')(Array.prototype.slice.call(arguments));
}, true);
desc("show various codebase stats");
@@ -23,12 +23,14 @@ function _getCmd() {
var exts = fs.readdirSync(_c.EXT), ext,
cmd = "",
nativeDir, simDir, deviceDir,
- configureX86, configureArm,
+ configureX86, configureARM,
+ stripX86, stripARM,
//Command constants
AND_CMD = " && ",
CD_CMD = "cd ",
MAKE_CMD = "make",
+ CP_CMD = "cp ",
SH_CMD = "sh ";
for (ext in exts) {
@@ -38,9 +40,13 @@ function _getCmd() {
deviceDir = path.join(_c.EXT, exts[ext], "device");
//configure-qsk commands
- configureX86 = path.join(nativeDir, "configure-qsk x86");
- configureArm = path.join(nativeDir, "configure-qsk arm a9");
+ configureX86 = path.join(simDir, "configure-qsk x86");
+ configureARM = path.join(deviceDir, "configure-qsk arm a9");
+ //strip binary commands
+ stripX86 = "ntox86-strip *.so";
+ stripARM = "ntoarmv7-strip *.so";
+
//If native folder exists, Build
if (path.existsSync(nativeDir)) {
if (!path.existsSync(simDir)) {
@@ -56,24 +62,29 @@ function _getCmd() {
}
if (utils.isWindows()) {
- cmd += CD_CMD + simDir + AND_CMD +
+ cmd += CP_CMD + _c.DEPENDENCIES_CONFIGURE_QSK + " " +
+ simDir + AND_CMD + CP_CMD + _c.DEPENDENCIES_CONFIGURE_QSK +
+ " " + deviceDir + AND_CMD +
+ CD_CMD + simDir + AND_CMD +
SH_CMD + configureX86 + AND_CMD +
- MAKE_CMD + AND_CMD +
+ MAKE_CMD + AND_CMD + stripX86 + AND_CMD +
CD_CMD + deviceDir + AND_CMD +
- SH_CMD + configureArm + AND_CMD +
- MAKE_CMD;
+ SH_CMD + configureARM + AND_CMD +
+ MAKE_CMD + AND_CMD + stripARM;
} else {
- cmd += CD_CMD + simDir + AND_CMD +
+ cmd += CP_CMD + _c.DEPENDENCIES_CONFIGURE_QSK + " " +
+ simDir + AND_CMD + CP_CMD + _c.DEPENDENCIES_CONFIGURE_QSK +
+ " " + deviceDir + AND_CMD +
+ CD_CMD + simDir + AND_CMD +
configureX86 + AND_CMD +
- MAKE_CMD + AND_CMD +
+ MAKE_CMD + AND_CMD + stripX86 + AND_CMD +
CD_CMD + deviceDir + AND_CMD +
- configureArm + AND_CMD +
- MAKE_CMD;
+ configureARM + AND_CMD +
+ MAKE_CMD + AND_CMD + stripARM;
}
}
}
-
return cmd;
}
View
@@ -27,5 +27,6 @@ module.exports = {
DEPENDENCIES_BOOTSTRAP: path.normalize(__dirname + "/../../dependencies/bootstrap"),
DEPENDENCIES_WEBPLATFORM_FRAMEWORK_LIB: path.normalize(__dirname + "/../../dependencies/webplatform-framework/lib"),
DEPENDENCIES_WEBPLATFORM_FRAMEWORK_REQUIRE: path.normalize(__dirname + "/../../dependencies/webplatform-framework/dependencies/browser-require/require.js"),
+ DEPENDENCIES_CONFIGURE_QSK: path.normalize(__dirname + "/../../dependencies/configure-qsk/configure-qsk"),
NODE_MOD: path.normalize(__dirname + "/../../node_modules")
};
View
@@ -15,33 +15,54 @@
*/
var childProcess = require('child_process'),
util = require('util'),
+ jWorkflow = require("jWorkflow"),
fs = require('fs');
-function _exec(cmdExpr, done) {
+function _exec(cmdExpr, prev, baton) {
+ baton.take();
var proc = childProcess.exec(cmdExpr, function (error, stdout, stderr) {
util.print(stdout);
util.print(stderr);
});
proc.on("exit", function (code) {
- process.exit(code);
+ if (code) {
+ util.puts("Lint FAILED");
+ process.exit(code);
+ }
+ baton.pass(prev);
});
}
+function _done() {
+ util.puts("Lint SUCCESS");
+ process.exit();
+}
-function _lintJS(files, done) {
- var options = ["--reporter", "build/lint/reporter.js", "--show-non-errors"];
- _exec('jshint ' + files.concat(options).join(' '), done);
+function _lintJS(prev, baton) {
+ var options = ["--reporter", "build/lint/reporter.js", "--show-non-errors"],
+ files = ["."];
+ _exec('jshint ' + files.concat(options).join(' '), prev, baton);
}
-function _lintCSS(files, done) {
+function _lintCSS(prev, baton) {
var rules = JSON.parse(fs.readFileSync(__dirname + "/../.csslintrc", "utf-8")),
- options = ["--rules=" + rules, "--format=compact"];
- _exec('csslint ' + files.concat(options).join(' '), done);
+ options = ["--rules=" + rules, "--format=compact"],
+ files = ["lib", "test"];
+ _exec('csslint ' + files.concat(options).join(' '), prev, baton);
+}
+
+function _lintCPP(prev, baton) {
+ var options = ["--R", "--filter=-whitespace/line_length,-whitespace/comments,-whitespace/labels"],
+ files = ["ext"];
+ _exec('python ' + __dirname + "/../dependencies/cpplint/cpplint.py " + options.concat(files).join(' '), prev, baton);
}
-module.exports = function (done, files) {
- var cssDirs = ["lib", "test"];
- _lintJS(files && files.length > 0 ? files : ["."], function () {
- _lintCSS(files && files.length > 0 ? files : cssDirs, done);
+module.exports = function (files) {
+ var lint = jWorkflow.order(_lintJS)
+ .andThen(_lintCSS)
+ .andThen(_lintCPP);
+
+ lint.start(function () {
+ _done();
});
};
Oops, something went wrong.

0 comments on commit e27fd4a

Please sign in to comment.