We do not release zip archives for any operating system except windows, and we do not release tar.gz archives for windows. For consistency and clarity sake, we'll explicitly list the architecture (x86) of the windows build as well.
36 lines
988 B
JavaScript
36 lines
988 B
JavaScript
module.exports = function createPackages(grunt) {
|
|
let { config } = grunt;
|
|
let { resolve } = require('path');
|
|
let { execFile } = require('child_process');
|
|
let { all, fromNode } = require('bluebird');
|
|
|
|
const targetDir = config.get('target');
|
|
let buildPath = resolve(config.get('root'), 'build');
|
|
let exec = async (cmd, args) => {
|
|
grunt.log.writeln(` > ${cmd} ${args.join(' ')}`);
|
|
await fromNode(cb => execFile(cmd, args, { cwd: buildPath }, cb));
|
|
};
|
|
|
|
|
|
let archives = async (platform) => {
|
|
if (/windows/.test(platform.name)) {
|
|
await exec('zip', ['-rq', '-ll', platform.zipPath, platform.buildName]);
|
|
} else {
|
|
await exec('tar', ['-zchf', platform.tarPath, platform.buildName]);
|
|
}
|
|
};
|
|
|
|
grunt.registerTask('_build:archives', function () {
|
|
|
|
all(
|
|
grunt.config.get('platforms')
|
|
.map(async platform => {
|
|
|
|
grunt.file.mkdir(targetDir);
|
|
await archives(platform);
|
|
})
|
|
)
|
|
.nodeify(this.async());
|
|
|
|
});
|
|
};
|