From 0cbbaf3330d1775d17e7784c21c93f5ff8459935 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Tue, 30 Oct 2018 19:58:50 -0700 Subject: [PATCH] Allows build to be ran on Windows (#24374) Signed-off-by: Tyler Smalley --- package.json | 1 + src/dev/build/tasks/create_archives_task.js | 19 +++------ src/dev/build/tasks/optimize_task.js | 4 +- yarn.lock | 46 ++++++++++++++++++++- 4 files changed, 52 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 413eea6de5ded..8950f1171f46e 100644 --- a/package.json +++ b/package.json @@ -296,6 +296,7 @@ "chokidar": "1.6.0", "chromedriver": "2.42.1", "classnames": "2.2.5", + "compressing": "^1.3.1", "dedent": "^0.7.0", "enzyme": "3.2.0", "enzyme-adapter-react-16": "^1.1.1", diff --git a/src/dev/build/tasks/create_archives_task.js b/src/dev/build/tasks/create_archives_task.js index eeff22aeae693..7387d1e57ebef 100644 --- a/src/dev/build/tasks/create_archives_task.js +++ b/src/dev/build/tasks/create_archives_task.js @@ -17,9 +17,10 @@ * under the License. */ -import { dirname, extname, basename } from 'path'; +import { dirname, extname } from 'path'; +import compressing from 'compressing'; -import { mkdirp, exec } from '../lib'; +import { mkdirp } from '../lib'; export const CreateArchivesTask = { description: 'Creating the archives for each platform', @@ -33,23 +34,13 @@ export const CreateArchivesTask = { await mkdirp(dirname(destination)); - const cwd = dirname(source); - const sourceName = basename(source); - switch (extname(destination)) { case '.zip': - await exec(log, 'zip', ['-rq', '-ll', destination, sourceName], { cwd }); + await compressing.zip.compressDir(source, destination); break; case '.gz': - const args = ['-zchf', destination, sourceName]; - - // Add a flag to handle filepaths with colons (i.e. C://...) on windows - if (config.getPlatformForThisOs().isWindows()) { - args.push('--force-local'); - } - - await exec(log, 'tar', args, { cwd }); + await compressing.tgz.compressDir(source, destination); break; default: diff --git a/src/dev/build/tasks/optimize_task.js b/src/dev/build/tasks/optimize_task.js index e2161f2cc1d44..d93aef950921f 100644 --- a/src/dev/build/tasks/optimize_task.js +++ b/src/dev/build/tasks/optimize_task.js @@ -39,15 +39,13 @@ export const OptimizeBuildTask = { const kibanaArgs = [ '--env.name=production', '--logging.json=false', - '--plugins.initialize=false', - '--server.autoListen=false', + '--optimize', ]; log.info('Running bin/kibana to trigger the optimizer'); await exec(log, kibanaScript, kibanaArgs, { cwd: build.resolvePath('.'), - exitAfter: /Optimization .+ complete/ }); // clean up temporary node install diff --git a/yarn.lock b/yarn.lock index b3ae7bb1b89dd..cfd7c5532778e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4034,6 +4034,20 @@ component-inherit@0.0.3: resolved "https://registry.yarnpkg.com/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143" integrity sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM= +compressing@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/compressing/-/compressing-1.3.1.tgz#9f11a94d648816eace4a6d97412fb17fc6e2767f" + integrity sha512-84G1GoJpy4AsCQ8eLcAr3KOanSUpbW9qaPpiqAoT8BugWP8/NMgrENiFriK82msIoSwEI7K4MH0myNGV4pJenw== + dependencies: + flushwritable "^1.0.0" + get-ready "^1.0.0" + mkdirp "^0.5.1" + pump "^3.0.0" + streamifier "^0.1.1" + tar-stream "^1.5.2" + yauzl "^2.7.0" + yazl "^2.4.2" + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -6635,6 +6649,11 @@ flush-write-stream@^1.0.2: inherits "^2.0.1" readable-stream "^2.0.4" +flushwritable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/flushwritable/-/flushwritable-1.0.0.tgz#3e328d8fde412ad47e738e3be750b4d290043498" + integrity sha1-PjKNj95BKtR+c44751C00pAENJg= + focus-trap-react@^3.0.4, focus-trap-react@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/focus-trap-react/-/focus-trap-react-3.1.2.tgz#4dd021ccd028bbd3321147d132cdf7585d6d1394" @@ -6934,6 +6953,11 @@ get-proxy@^2.0.0: dependencies: npm-conf "^1.1.0" +get-ready@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/get-ready/-/get-ready-1.0.0.tgz#f91817f1e9adecfea13a562adfc8de883ab34782" + integrity sha1-+RgX8emt7P6hOlYq38jeiDqzR4I= + get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" @@ -12947,6 +12971,14 @@ pump@^2.0.0, pump@^2.0.1: end-of-stream "^1.1.0" once "^1.3.1" +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + pumpify@1.3.x: version "1.3.6" resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.3.6.tgz#00d40e5ded0a3bf1e0788b1c0cf426a42882ab64" @@ -15262,6 +15294,11 @@ stream-to@~0.2.0: resolved "https://registry.yarnpkg.com/stream-to/-/stream-to-0.2.2.tgz#84306098d85fdb990b9fa300b1b3ccf55e8ef01d" integrity sha1-hDBgmNhf25kLn6MAsbPM9V6O8B0= +streamifier@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/streamifier/-/streamifier-0.1.1.tgz#97e98d8fa4d105d62a2691d1dc07e820db8dfc4f" + integrity sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8= + strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" @@ -17619,7 +17656,7 @@ yauzl@2.7.0: buffer-crc32 "~0.2.3" fd-slicer "~1.0.1" -yauzl@^2.10.0: +yauzl@^2.10.0, yauzl@^2.7.0: version "2.10.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" integrity sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk= @@ -17635,6 +17672,13 @@ yauzl@^2.4.2: buffer-crc32 "~0.2.3" fd-slicer "~1.0.1" +yazl@^2.4.2: + version "2.4.3" + resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.4.3.tgz#ec26e5cc87d5601b9df8432dbdd3cd2e5173a071" + integrity sha1-7CblzIfVYBud+EMtvdPNLlFzoHE= + dependencies: + buffer-crc32 "~0.2.3" + yeast@0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"