mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Ignore OS-specific files in other operating systems. Fixes #4460
This commit is contained in:
parent
ecd13ad0e7
commit
79739ab5ce
3 changed files with 44 additions and 0 deletions
|
@ -179,6 +179,7 @@
|
|||
"makelogs": "3.0.0-beta3",
|
||||
"marked-text-renderer": "0.1.0",
|
||||
"mocha": "2.3.0",
|
||||
"ncp": "2.0.0",
|
||||
"nock": "2.10.0",
|
||||
"npm": "2.11.0",
|
||||
"portscanner": "1.0.0",
|
||||
|
|
|
@ -22,6 +22,7 @@ module.exports = function (grunt) {
|
|||
'stop:optimizeBuild',
|
||||
'_build:downloadNodeBuilds:finish',
|
||||
'_build:versionedLinks',
|
||||
'_build:osShellScripts',
|
||||
'_build:archives',
|
||||
grunt.option('os-packages') ? [
|
||||
'_build:pleaseRun',
|
||||
|
|
42
tasks/build/os_shell_scripts.js
Normal file
42
tasks/build/os_shell_scripts.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
import {unlink} from 'fs';
|
||||
import {join, extname} from 'path';
|
||||
import {promisify} from 'bluebird';
|
||||
import {ncp} from 'ncp';
|
||||
const pncp = promisify(ncp);
|
||||
const punlink = promisify(unlink);
|
||||
|
||||
export default function (grunt) {
|
||||
grunt.registerTask('_build:osShellScripts', async function osShellScripts() {
|
||||
const done = this.async();
|
||||
const source = 'build/kibana/bin';
|
||||
const platforms = grunt.config.get('platforms');
|
||||
const allPlatforms = fn => invokeAllAsync(platforms, fn);
|
||||
|
||||
try {
|
||||
await allPlatforms(platform => punlink(join(platform.buildDir, 'bin')));
|
||||
await allPlatforms(platform => pncp(source, join(platform.buildDir, 'bin')));
|
||||
await allPlatforms(platform => removeExtraneousShellScripts(grunt, platform));
|
||||
done();
|
||||
} catch (err) {
|
||||
done(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function invokeAllAsync(all, fn) {
|
||||
return Promise.all(all.map(fn));
|
||||
}
|
||||
|
||||
function removeExtraneousShellScripts(grunt, platform) {
|
||||
return Promise.all(grunt.file
|
||||
.expand(join(platform.buildDir, 'bin', '*'))
|
||||
.filter(file => isExtraneous(platform, file))
|
||||
.map(file => punlink(file)));
|
||||
}
|
||||
|
||||
function isExtraneous(platform, file) {
|
||||
const ext = extname(file);
|
||||
if (platform.win && ext === '') { return true; }
|
||||
if (!platform.win && ext === '.bat') { return true; }
|
||||
return false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue