vscode/gulpfile.js

78 lines
2.8 KiB
JavaScript
Raw Normal View History

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
// Increase max listeners for event emitters
require('events').EventEmitter.defaultMaxListeners = 100;
const gulp = require('gulp');
const util = require('./build/lib/util');
const path = require('path');
const compilation = require('./build/lib/compilation');
// Fast compile for development time
gulp.task('clean-client', util.rimraf('out'));
2018-07-19 21:05:38 +02:00
gulp.task('compile-client', ['clean-client'], compilation.compileTask('src', 'out', false));
gulp.task('watch-client', ['clean-client'], compilation.watchTask('out', false));
// Full compile, including nls and inline sources in sourcemaps, for build
2016-03-08 10:43:43 +01:00
gulp.task('clean-client-build', util.rimraf('out-build'));
2018-07-19 21:05:38 +02:00
gulp.task('compile-client-build', ['clean-client-build'], compilation.compileTask('src', 'out-build', true));
gulp.task('watch-client-build', ['clean-client-build'], compilation.watchTask('out-build', true));
// Default
2016-02-18 17:53:24 +01:00
gulp.task('default', ['compile']);
// All
2016-03-01 11:36:32 +01:00
gulp.task('clean', ['clean-client', 'clean-extensions']);
gulp.task('compile', ['monaco-typecheck', 'compile-client', 'compile-extensions']);
gulp.task('watch', [/* 'monaco-typecheck-watch', */ 'watch-client', 'watch-extensions']);
2016-03-08 10:43:43 +01:00
// All Build
gulp.task('clean-build', ['clean-client-build', 'clean-extensions-build']);
gulp.task('compile-build', ['compile-client-build', 'compile-extensions-build']);
gulp.task('watch-build', ['watch-client-build', 'watch-extensions-build']);
var ALL_EDITOR_TASKS = [
2016-10-20 15:30:53 +02:00
// Always defined tasks
'clean-client',
'compile-client',
'watch-client',
'clean-client-build',
'compile-client-build',
'watch-client-build',
// Editor tasks (defined in gulpfile.editor)
'clean-optimized-editor',
'optimize-editor',
'clean-minified-editor',
'minify-editor',
'clean-editor-distro',
'editor-distro',
2016-10-21 09:38:01 +02:00
'analyze-editor-distro',
// hygiene tasks
'tslint',
'hygiene',
];
2016-10-31 11:27:40 +01:00
var runningEditorTasks = process.argv.length > 2 && process.argv.slice(2).every(function (arg) { return (ALL_EDITOR_TASKS.indexOf(arg) !== -1); });
2016-10-19 17:58:50 +02:00
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
process.exit(1);
});
if (runningEditorTasks) {
require(`./build/gulpfile.editor`);
2016-10-21 09:38:01 +02:00
require(`./build/gulpfile.hygiene`);
} else {
2016-10-19 17:58:50 +02:00
// Load all the gulpfiles only if running tasks other than the editor tasks
const build = path.join(__dirname, 'build');
2016-10-20 15:49:20 +02:00
require('glob').sync('gulpfile.*.js', { cwd: build })
2016-10-31 11:27:40 +01:00
.forEach(f => require(`./build/${f}`));
}