aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Budzenski <jbudz@users.noreply.github.com>2018-06-01 15:25:25 -0500
committerGitHub <noreply@github.com>2018-06-01 15:25:25 -0500
commit5da80f12e32f969de56f9b121b3d827847663cbe (patch)
tree824bb476a2ffce26404e5e4e3628785f5550fd7a
parent9b796133c1b28e214b1376ac3ed5729e6035c784 (diff)
[build] Clean extra browsers (#19605)
* [build] Clean extra browsers * remove log * cleanup * refactor * names
-rw-r--r--src/dev/build/build_distributables.js2
-rw-r--r--src/dev/build/tasks/clean_tasks.js43
2 files changed, 45 insertions, 0 deletions
diff --git a/src/dev/build/build_distributables.js b/src/dev/build/build_distributables.js
index fceb037f6..817c3418c 100644
--- a/src/dev/build/build_distributables.js
+++ b/src/dev/build/build_distributables.js
@@ -23,6 +23,7 @@ import {
BootstrapTask,
BuildPackagesTask,
CleanExtraBinScriptsTask,
+ CleanExtraBrowsersTask,
CleanExtraFilesFromModulesTask,
CleanPackagesTask,
CleanTypescriptTask,
@@ -116,6 +117,7 @@ export async function buildDistributables(options) {
*/
await run(CreateArchivesSourcesTask);
await run(CleanExtraBinScriptsTask);
+ await run(CleanExtraBrowsersTask);
/**
* package platform-specific builds into archives
diff --git a/src/dev/build/tasks/clean_tasks.js b/src/dev/build/tasks/clean_tasks.js
index c4cb113f8..9a7f53638 100644
--- a/src/dev/build/tasks/clean_tasks.js
+++ b/src/dev/build/tasks/clean_tasks.js
@@ -84,3 +84,46 @@ export const CleanExtraBinScriptsTask = {
}
}
};
+
+export const CleanExtraBrowsersTask = {
+ description: 'Cleaning extra browsers from platform-specific builds',
+
+ async run(config, log, build) {
+ const getBrowserPathsForPlatform = (platform) => {
+ const reportingDir = 'node_modules/x-pack/plugins/reporting';
+ const phantomDir = '.phantom';
+ const chromiumDir = '.chromium';
+ const phantomPath = p => build.resolvePathForPlatform(platform, reportingDir, phantomDir, p);
+ const chromiumPath = p => build.resolvePathForPlatform(platform, reportingDir, chromiumDir, p);
+ return platforms => {
+ const paths = [];
+ if (platforms.windows) {
+ paths.push(phantomPath('phantomjs-*-windows.zip'));
+ paths.push(chromiumPath('chromium-*-win32.zip'));
+ }
+
+ if (platforms.darwin) {
+ paths.push(phantomPath('phantomjs-*-macosx.zip'));
+ paths.push(chromiumPath('chromium-*-darwin.zip'));
+ }
+
+ if (platforms.linux) {
+ paths.push(phantomPath('phantomjs-*-linux-x86_64.tar.bz2'));
+ paths.push(chromiumPath('chromium-*-linux.zip'));
+ }
+ return paths;
+ };
+ };
+ for (const platform of config.getPlatforms()) {
+ const getBrowserPaths = getBrowserPathsForPlatform(platform);
+ if (platform.isWindows()) {
+ await deleteAll(log, getBrowserPaths({ linux: true, darwin: true }));
+ }
+ else if (platform.isMac()) {
+ await deleteAll(log, getBrowserPaths({ linux: true, windows: true }));
+ } else if (platform.isLinux()) {
+ await deleteAll(log, getBrowserPaths({ windows: true, darwin: true }));
+ }
+ }
+ }
+};