Merge pull request #7141 from LeeDr/fix-build-windows-cygwin

Re-applied PR 6267 to master to fix Windows/cygwin build
Credit for this work goes to @repocho.  Thanks for getting Windows builds working!
This commit is contained in:
Lee Drengenberg 2016-05-05 11:08:01 -05:00
commit b19cb6dbb3
4 changed files with 10 additions and 7 deletions

View file

@ -55,7 +55,7 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
npm run elasticsearch
```
- Start the development server. _On Windows, you'll need you use Git Bash, Cygwin, or a similar shell that exposes the `sh` command._
- Start the development server. _On Windows, you'll need you use Git Bash, Cygwin, or a similar shell that exposes the `sh` command. And to successfully build you'll need Cygwin optional packages zip, tar, and shasum._
```sh
npm start

View file

@ -1,6 +1,6 @@
module.exports = function createPackages(grunt) {
let { config } = grunt;
let { resolve } = require('path');
let { resolve, relative } = require('path');
let { execFile } = require('child_process');
let { all, fromNode } = require('bluebird');
@ -13,13 +13,13 @@ module.exports = function createPackages(grunt) {
let archives = async (platform) => {
// kibana.tar.gz
await exec('tar', ['-zchf', platform.tarPath, platform.buildName]);
await exec('tar', ['-zchf', relative(buildPath, platform.tarPath), platform.buildName]);
// kibana.zip
if (/windows/.test(platform.name)) {
await exec('zip', ['-rq', '-ll', platform.zipPath, platform.buildName]);
await exec('zip', ['-rq', '-ll', relative(buildPath, platform.zipPath), platform.buildName]);
} else {
await exec('zip', ['-rq', platform.zipPath, platform.buildName]);
await exec('zip', ['-rq', relative(buildPath, platform.zipPath), platform.buildName]);
}
};

View file

@ -1,6 +1,8 @@
var { promisify } = require('bluebird');
var readdir = promisify(require('fs').readdir);
var exec = promisify(require('child_process').exec);
var platform = require('os').platform();
var cmd = /^win/.test(platform) ? 'sha1sum ' : 'shasum ';
module.exports = function (grunt) {
grunt.registerTask('_build:shasums', function () {
@ -11,7 +13,7 @@ module.exports = function (grunt) {
// only sha the archives
if (!archive.match(/\.zip$|\.tar.gz$/)) return;
return exec('shasum ' + archive + ' > ' + archive + '.sha1.txt', {
return exec(cmd + archive + ' > ' + archive + '.sha1.txt', {
cwd: targetDir
});
})

View file

@ -4,6 +4,7 @@ module.exports = function (grunt) {
let {resolve} = require('path');
let root = p => resolve(__dirname, '../../', p);
let binScript = /^win/.test(platform) ? '.\\bin\\kibana.bat' : './bin/kibana';
let buildScript = /^win/.test(platform) ? '.\\build\\kibana\\bin\\kibana.bat' : './build/kibana/bin/kibana';
let uiConfig = require(root('test/server_config'));
const stdDevArgs = [
@ -150,7 +151,7 @@ module.exports = function (grunt) {
ready: /Optimization .+ complete/,
quiet: true
},
cmd: './build/kibana/bin/kibana',
cmd: buildScript,
args: [
'--env.name=production',
'--logging.json=false',