Skip to content

Instantly share code, notes, and snippets.

@xdghcnt
Created September 8, 2014 10:15
Show Gist options
  • Save xdghcnt/501a7e9b293fd270405c to your computer and use it in GitHub Desktop.
Save xdghcnt/501a7e9b293fd270405c to your computer and use it in GitHub Desktop.
config.task("build-all", function (task) {
var def = Vow.defer();
try {
var makePlatform = task.getMakePlatform(),
nodes = Object.keys(makePlatform.getProjectConfig().getNodeConfigs());
makePlatform._cache = new Cache(makePlatform._cacheStorage, makePlatform._projectName);
Vow.all(nodes.map(function (node) {
return makePlatform.initNode(node);
})).then(function () {
try {
var targets = [];
Object.keys(makePlatform._nodes).forEach(function (nodePath) {
targets = targets.concat(makePlatform._nodes[nodePath]._targetNamesToBuild.map(function (targetName) {
return nodePath + "/" + targetName;
}));
});
var count = 0,
tasks = chunk(targets, chunkSize).map(function (targetsChunk) {
return function (callback) {
task.log("Building " + count + " - " + (count += chunkSize) + " targets");
task.buildTargets(targetsChunk).then(
function () {
callback(null, true);
},
function (error) {
callback(error);
}
);
};
});
async.series(tasks, function (error) {
if (error)
def.reject(error);
else
def.resolve();
});
} catch (error) {
def.reject(error);
}
});
} catch (error) {
def.reject(error);
}
return def.promise();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment