From c0c719c6511d15160dd5d20b175f954f34bcc76e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 4 Feb 2019 18:06:23 +0100 Subject: [PATCH] More gulp task work (#67863) --- build/gulpfile.extensions.js | 2 +- build/gulpfile.vscode.js | 32 +++++++++++++++++++++----------- build/lib/util.ts | 4 ++-- gulpfile.js | 6 ------ 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js index 64d5c213cc6..46fc1940bd5 100644 --- a/build/gulpfile.extensions.js +++ b/build/gulpfile.extensions.js @@ -143,4 +143,4 @@ const tasks = compilations.map(function (tsconfigFile) { gulp.task('compile-extensions', util.task.parallel(...tasks.map(t => t.compileTask))); gulp.task('watch-extensions', util.task.parallel(...tasks.map(t => t.watchTask))); -gulp.task('compile-extensions-build', util.task.parallel(...tasks.map(t => t.compileBuildTask))); +exports.compileExtensionsBuildTask = util.task.parallel(...tasks.map(t => t.compileBuildTask)); diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index e81b0925f64..dde330fb9ea 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -33,6 +33,8 @@ const deps = require('./dependencies'); const getElectronVersion = require('./lib/electron').getElectronVersion; const createAsar = require('./lib/asar').createAsar; const minimist = require('minimist'); +const compilation = require('./lib/compilation'); +const { compileExtensionsBuildTask } = require('./gulpfile.extensions'); const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname)); // @ts-ignore @@ -86,17 +88,25 @@ const BUNDLED_FILE_HEADER = [ ' *--------------------------------------------------------*/' ].join('\n'); -gulp.task('clean-optimized-vscode', util.rimraf('out-vscode')); -gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compile-extensions-build'], common.optimizeTask({ - src: 'out-build', - entryPoints: vscodeEntryPoints, - otherSources: [], - resources: vscodeResources, - loaderConfig: common.loaderConfig(nodeModules), - header: BUNDLED_FILE_HEADER, - out: 'out-vscode', - bundleInfo: undefined -})); +// Full compile, including nls and inline sources in sourcemaps, for build +const compileClientBuildTask = util.task.series(util.rimraf('out-build'), compilation.compileTask('src', 'out-build', true)); + +// All Build +const compileBuildTask = util.task.parallel(compileClientBuildTask, compileExtensionsBuildTask); + +gulp.task('optimize-vscode', util.task.series( + util.task.parallel(util.rimraf('out-vscode'), compileBuildTask), + common.optimizeTask({ + src: 'out-build', + entryPoints: vscodeEntryPoints, + otherSources: [], + resources: vscodeResources, + loaderConfig: common.loaderConfig(nodeModules), + header: BUNDLED_FILE_HEADER, + out: 'out-vscode', + bundleInfo: undefined + })) +); gulp.task('optimize-index-js', ['optimize-vscode'], () => { diff --git a/build/lib/util.ts b/build/lib/util.ts index e0d56b59e77..4ff07196612 100644 --- a/build/lib/util.ts +++ b/build/lib/util.ts @@ -292,7 +292,7 @@ export namespace task { }); } - export function series(...tasks: Task[]): () => Promise { + export function series(...tasks: Task[]): PromiseTask { return async () => { for (let i = 0; i < tasks.length; i++) { await _execute(tasks[i]); @@ -300,7 +300,7 @@ export namespace task { }; } - export function parallel(...tasks: Task[]): () => Promise { + export function parallel(...tasks: Task[]): PromiseTask { return async () => { await Promise.all(tasks.map(t => _execute(t))); }; diff --git a/gulpfile.js b/gulpfile.js index 71e1618ae43..0f3fc9cc72c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -17,9 +17,6 @@ const compilation = require('./build/lib/compilation'); gulp.task('compile-client', util.task.series(util.rimraf('out'), compilation.compileTask('src', 'out', false))); gulp.task('watch-client', util.task.series(util.rimraf('out'), compilation.watchTask('out', false))); -// Full compile, including nls and inline sources in sourcemaps, for build -gulp.task('compile-client-build', util.task.series(util.rimraf('out-build'), compilation.compileTask('src', 'out-build', true))); - // Default gulp.task('default', ['compile']); @@ -27,9 +24,6 @@ gulp.task('default', ['compile']); gulp.task('compile', ['monaco-typecheck', 'compile-client', 'compile-extensions']); gulp.task('watch', [/* 'monaco-typecheck-watch', */ 'watch-client', 'watch-extensions']); -// All Build -gulp.task('compile-build', ['compile-client-build', 'compile-extensions-build']); - process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); process.exit(1);