Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] PR #7495 to 4.x - Consistent build archives #7813

Merged
merged 1 commit into from
Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ For the daring, snapshot builds are available. These builds are created after ea
| OSX | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-darwin-x64.tar.gz) |
| Linux x64 | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-linux-x64.tar.gz) [deb](https://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-amd64.deb) [rpm](https://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-x86_64.rpm) |
| Linux x86 | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-linux-x86.tar.gz) [deb](https://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-i386.deb) [rpm](https://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-i686.rpm) |
| Windows | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-windows.zip) |
| Windows | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-4.6.0-SNAPSHOT-windows-x86.zip) |
40 changes: 16 additions & 24 deletions tasks/build/archives.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
module.exports = function createPackages(grunt) {
let { config } = grunt;
let { resolve } = require('path');
let { execFile } = require('child_process');
let { all, fromNode } = require('bluebird');
import { execFile } from 'child_process';
import { all, fromNode } from '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));
};
export default (grunt) => {
const { config, log } = grunt;

const cwd = config.get('buildDir');
const targetDir = config.get('target');

let archives = async (platform) => {
// kibana.tar.gz
await exec('tar', ['-zchf', platform.tarPath, platform.buildName]);
async function exec(cmd, args) {
log.writeln(` > ${cmd} ${args.join(' ')}`);
await fromNode(cb => execFile(cmd, args, { cwd }, cb));
};

// kibana.zip
if (/windows/.test(platform.name)) {
await exec('zip', ['-rq', '-ll', platform.zipPath, platform.buildName]);
async function archives({ name, buildName, zipPath, tarPath }) {
if (/windows/.test(name)) {
await exec('zip', ['-rq', '-ll', zipPath, buildName]);
} else {
await exec('zip', ['-rq', platform.zipPath, platform.buildName]);
await exec('tar', ['-zchf', tarPath, buildName]);
}
};

grunt.registerTask('_build:archives', function () {
grunt.file.mkdir(targetDir);

all(
grunt.config.get('platforms')
.map(async platform => {

grunt.file.mkdir(targetDir);
await archives(platform);
})
config.get('platforms').map(async platform => await archives(platform))
)
.nodeify(this.async());

Expand Down
2 changes: 1 addition & 1 deletion tasks/build/downloadNodeBuilds.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = function (grunt) {
platform.downloadPromise = (async function () {
grunt.file.mkdir(downloadDir);

if (platform.name === 'windows') {
if (platform.win) {
await fromNode(cb => {
resp
.pipe(createWriteStream(resolve(downloadDir, 'node.exe')))
Expand Down
4 changes: 2 additions & 2 deletions tasks/config/platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ module.exports = function (grunt) {
'darwin-x64',
'linux-x64',
'linux-x86',
'windows'
'windows-x86'
].map(function (name) {
let win = name === 'windows';
let win = name === 'windows-x86';

let nodeUrl = win ? `${baseUri}/win-x86/node.exe` : `${baseUri}/node-v${nodeVersion}-${name}.tar.gz`;
let nodeDir = resolve(rootPath, `.node_binaries/${nodeVersion}/${name}`);
Expand Down