Skip to content

Commit

Permalink
Merge pull request #7141 from LeeDr/fix-build-windows-cygwin
Browse files Browse the repository at this point in the history
Re-applied PR 6267 to master to fix Windows/cygwin build
Credit for this work goes to @repocho.  Thanks for getting Windows builds working!
  • Loading branch information
Lee Drengenberg committed May 5, 2016
2 parents 1f0a452 + 82b06cd commit b19cb6d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tasks/build/archives.js
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -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]);
}
};

Expand Down
4 changes: 3 additions & 1 deletion tasks/build/shasums.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand All @@ -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
});
})
Expand Down
3 changes: 2 additions & 1 deletion tasks/config/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit b19cb6d

Please sign in to comment.