diff options
-rw-r--r-- | build/gulpfile.editor.js | 9 | ||||
-rw-r--r-- | build/gulpfile.extensions.js | 12 | ||||
-rw-r--r-- | build/gulpfile.vscode.js | 166 | ||||
-rw-r--r-- | build/gulpfile.vscode.linux.js | 65 | ||||
-rw-r--r-- | build/gulpfile.vscode.win32.js | 7 | ||||
-rw-r--r-- | gulpfile.js | 22 |
6 files changed, 164 insertions, 117 deletions
diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index eb59eb533e1..2c68dc74185 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -370,7 +370,12 @@ function createTscCompileTask(watch) { }; } -gulp.task('monaco-typecheck-watch', createTscCompileTask(true)); -gulp.task('monaco-typecheck', createTscCompileTask(false)); +const monacoTypecheckWatchTask = createTscCompileTask(true); +monacoTypecheckWatchTask.displayName = 'monaco-typecheck-watch'; +exports.monacoTypecheckWatchTask = monacoTypecheckWatchTask; + +const monacoTypecheckTask = createTscCompileTask(false); +monacoTypecheckTask.displayName = 'monaco-typecheck'; +exports.monacoTypecheckTask = monacoTypecheckTask; //#endregion diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js index af3278cde5e..3a780a22e8d 100644 --- a/build/gulpfile.extensions.js +++ b/build/gulpfile.extensions.js @@ -141,10 +141,16 @@ 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))); +const compileExtensionsTask = util.task.parallel(...tasks.map(t => t.compileTask)); +compileExtensionsTask.displayName = 'compile-extensions'; +gulp.task(compileExtensionsTask.displayName, compileExtensionsTask); +exports.compileExtensionsTask = compileExtensionsTask; + +const watchExtensionsTask = util.task.parallel(...tasks.map(t => t.watchTask)); +watchExtensionsTask.displayName = 'watch-extensions'; +gulp.task(watchExtensionsTask.displayName, watchExtensionsTask); +exports.watchExtensionsTask = watchExtensionsTask; const compileExtensionsBuildTask = util.task.parallel(...tasks.map(t => t.compileBuildTask)); compileExtensionsBuildTask.displayName = 'compile-extensions-build'; - exports.compileExtensionsBuildTask = compileExtensionsBuildTask; diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index c5887cde3f7..1cbd189b79e 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -104,7 +104,6 @@ const optimizeVSCodeTask = util.task.series( }) ); optimizeVSCodeTask.displayName = 'optimize-vscode'; -gulp.task(optimizeVSCodeTask.displayName, optimizeVSCodeTask); const optimizeIndexJSTask = util.task.series( @@ -492,30 +491,40 @@ const apiHostname = process.env.TRANSIFEX_API_URL; const apiName = process.env.TRANSIFEX_API_NAME; const apiToken = process.env.TRANSIFEX_API_TOKEN; -gulp.task('vscode-translations-push', ['optimize-vscode'], function () { - const pathToMetadata = './out-vscode/nls.metadata.json'; - const pathToExtensions = './extensions/*'; - const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}'; - - return es.merge( - gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()), - gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()), - gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions()) - ).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken) - ).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken)); -}); - -gulp.task('vscode-translations-export', ['optimize-vscode'], function () { - const pathToMetadata = './out-vscode/nls.metadata.json'; - const pathToExtensions = './extensions/*'; - const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}'; +gulp.task('vscode-translations-push', + util.task.series( + optimizeVSCodeTask, + function () { + const pathToMetadata = './out-vscode/nls.metadata.json'; + const pathToExtensions = './extensions/*'; + const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}'; + + return es.merge( + gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()), + gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()), + gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions()) + ).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken) + ).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken)); + } + ) +); - return es.merge( - gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()), - gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()), - gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions()) - ).pipe(vfs.dest('../vscode-translations-export')); -}); +gulp.task('vscode-translations-export', + util.task.series( + optimizeVSCodeTask, + function () { + const pathToMetadata = './out-vscode/nls.metadata.json'; + const pathToExtensions = './extensions/*'; + const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}'; + + return es.merge( + gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()), + gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()), + gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions()) + ).pipe(vfs.dest('../vscode-translations-export')); + } + ) +); gulp.task('vscode-translations-pull', function () { return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => { @@ -565,57 +574,8 @@ gulp.task('upload-vscode-sourcemaps', () => { })); }); -const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json'); -gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () => { - if (!shouldSetupSettingsSearch()) { - const branch = process.env.BUILD_SOURCEBRANCH; - console.log(`Only runs on master and release branches, not ${branch}`); - return; - } - - if (!fs.existsSync(allConfigDetailsPath)) { - throw new Error(`configuration file at ${allConfigDetailsPath} does not exist`); - } - - const settingsSearchBuildId = getSettingsSearchBuildId(packageJson); - if (!settingsSearchBuildId) { - throw new Error('Failed to compute build number'); - } - - return gulp.src(allConfigDetailsPath) - .pipe(azure.upload({ - account: process.env.AZURE_STORAGE_ACCOUNT, - key: process.env.AZURE_STORAGE_ACCESS_KEY, - container: 'configuration', - prefix: `${settingsSearchBuildId}/${commit}/` - })); -}); - -function shouldSetupSettingsSearch() { - const branch = process.env.BUILD_SOURCEBRANCH; - return branch && (/\/master$/.test(branch) || branch.indexOf('/release/') >= 0); -} - -function getSettingsSearchBuildId(packageJson) { - try { - const branch = process.env.BUILD_SOURCEBRANCH; - const branchId = branch.indexOf('/release/') >= 0 ? 0 : - /\/master$/.test(branch) ? 1 : - 2; // Some unexpected branch - - const out = cp.execSync(`git rev-list HEAD --count`); - const count = parseInt(out.toString()); - - // <version number><commit count><branchId (avoid unlikely conflicts)> - // 1.25.1, 1,234,567 commits, master = 1250112345671 - return util.versionStringToNumber(packageJson.version) * 1e8 + count * 10 + branchId; - } catch (e) { - throw new Error('Could not determine build number: ' + e.toString()); - } -} - // This task is only run for the MacOS build -gulp.task('generate-vscode-configuration', () => { +const generateVSCodeConfigurationTask = () => { return new Promise((resolve, reject) => { const buildDir = process.env['AGENT_BUILDDIRECTORY']; if (!buildDir) { @@ -650,4 +610,60 @@ gulp.task('generate-vscode-configuration', () => { reject(err); }); }); -}); +}; +generateVSCodeConfigurationTask.displayName = 'generate-vscode-configuration'; + +const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json'); +gulp.task('upload-vscode-configuration', + util.task.series( + generateVSCodeConfigurationTask, + () => { + if (!shouldSetupSettingsSearch()) { + const branch = process.env.BUILD_SOURCEBRANCH; + console.log(`Only runs on master and release branches, not ${branch}`); + return; + } + + if (!fs.existsSync(allConfigDetailsPath)) { + throw new Error(`configuration file at ${allConfigDetailsPath} does not exist`); + } + + const settingsSearchBuildId = getSettingsSearchBuildId(packageJson); + if (!settingsSearchBuildId) { + throw new Error('Failed to compute build number'); + } + + return gulp.src(allConfigDetailsPath) + .pipe(azure.upload({ + account: process.env.AZURE_STORAGE_ACCOUNT, + key: process.env.AZURE_STORAGE_ACCESS_KEY, + container: 'configuration', + prefix: `${settingsSearchBuildId}/${commit}/` + })); + } + ) +); + +function shouldSetupSettingsSearch() { + const branch = process.env.BUILD_SOURCEBRANCH; + return branch && (/\/master$/.test(branch) || branch.indexOf('/release/') >= 0); +} + +function getSettingsSearchBuildId(packageJson) { + try { + const branch = process.env.BUILD_SOURCEBRANCH; + const branchId = branch.indexOf('/release/') >= 0 ? 0 : + /\/master$/.test(branch) ? 1 : + 2; // Some unexpected branch + + const out = cp.execSync(`git rev-list HEAD --count`); + const count = parseInt(out.toString()); + + // <version number><commit count><branchId (avoid unlikely conflicts)> + // 1.25.1, 1,234,567 commits, master = 1250112345671 + return util.versionStringToNumber(packageJson.version) * 1e8 + count * 10 + branchId; + } catch (e) { + throw new Error('Could not determine build number: ' + e.toString()); + } +} + diff --git a/build/gulpfile.vscode.linux.js b/build/gulpfile.vscode.linux.js index 6728a0ce640..b3599cbe39d 100644 --- a/build/gulpfile.vscode.linux.js +++ b/build/gulpfile.vscode.linux.js @@ -229,29 +229,42 @@ function buildSnapPackage(arch) { return shell.task(`cd ${snapBuildPath} && snapcraft build`); } -gulp.task('vscode-linux-ia32-prepare-deb', util.task.series(util.rimraf('.build/linux/deb/i386'), prepareDebPackage('ia32'))); -gulp.task('vscode-linux-x64-prepare-deb', util.task.series(util.rimraf('.build/linux/deb/amd64'), prepareDebPackage('x64'))); -gulp.task('vscode-linux-arm-prepare-deb', util.task.series(util.rimraf('.build/linux/deb/armhf'), prepareDebPackage('arm'))); -gulp.task('vscode-linux-arm64-prepare-deb', util.task.series(util.rimraf('.build/linux/deb/arm64'), prepareDebPackage('arm64'))); -gulp.task('vscode-linux-ia32-build-deb', ['vscode-linux-ia32-prepare-deb'], buildDebPackage('ia32')); -gulp.task('vscode-linux-x64-build-deb', ['vscode-linux-x64-prepare-deb'], buildDebPackage('x64')); -gulp.task('vscode-linux-arm-build-deb', ['vscode-linux-arm-prepare-deb'], buildDebPackage('arm')); -gulp.task('vscode-linux-arm64-build-deb', ['vscode-linux-arm64-prepare-deb'], buildDebPackage('arm64')); - -gulp.task('vscode-linux-ia32-prepare-rpm', util.task.series(util.rimraf('.build/linux/rpm/i386'), prepareRpmPackage('ia32'))); -gulp.task('vscode-linux-x64-prepare-rpm', util.task.series(util.rimraf('.build/linux/rpm/x86_64'), prepareRpmPackage('x64'))); -gulp.task('vscode-linux-arm-prepare-rpm', util.task.series(util.rimraf('.build/linux/rpm/armhf'), prepareRpmPackage('arm'))); -gulp.task('vscode-linux-arm64-prepare-rpm', util.task.series(util.rimraf('.build/linux/rpm/arm64'), prepareRpmPackage('arm64'))); -gulp.task('vscode-linux-ia32-build-rpm', ['vscode-linux-ia32-prepare-rpm'], buildRpmPackage('ia32')); -gulp.task('vscode-linux-x64-build-rpm', ['vscode-linux-x64-prepare-rpm'], buildRpmPackage('x64')); -gulp.task('vscode-linux-arm-build-rpm', ['vscode-linux-arm-prepare-rpm'], buildRpmPackage('arm')); -gulp.task('vscode-linux-arm64-build-rpm', ['vscode-linux-arm64-prepare-rpm'], buildRpmPackage('arm64')); - -gulp.task('vscode-linux-ia32-prepare-snap', util.task.series(util.rimraf('.build/linux/snap/x64'), prepareSnapPackage('ia32'))); -gulp.task('vscode-linux-x64-prepare-snap', util.task.series(util.rimraf('.build/linux/snap/x64'), prepareSnapPackage('x64'))); -gulp.task('vscode-linux-arm-prepare-snap', util.task.series(util.rimraf('.build/linux/snap/x64'), prepareSnapPackage('arm'))); -gulp.task('vscode-linux-arm64-prepare-snap', util.task.series(util.rimraf('.build/linux/snap/x64'), prepareSnapPackage('arm64'))); -gulp.task('vscode-linux-ia32-build-snap', ['vscode-linux-ia32-prepare-snap'], buildSnapPackage('ia32')); -gulp.task('vscode-linux-x64-build-snap', ['vscode-linux-x64-prepare-snap'], buildSnapPackage('x64')); -gulp.task('vscode-linux-arm-build-snap', ['vscode-linux-arm-prepare-snap'], buildSnapPackage('arm')); -gulp.task('vscode-linux-arm64-build-snap', ['vscode-linux-arm64-prepare-snap'], buildSnapPackage('arm64')); +const BUILD_TARGETS = [ + { arch: 'ia32' }, + { arch: 'x64' }, + { arch: 'arm' }, + { arch: 'arm64' }, +]; + +BUILD_TARGETS.forEach((buildTarget) => { + const arch = buildTarget.arch; + + { + const debArch = getDebPackageArch(arch); + const prepareDebTask = util.task.series(util.rimraf(`.build/linux/deb/${debArch}`), prepareDebPackage(arch)); + prepareDebTask.displayName = `vscode-linux-${arch}-prepare-deb`; + // gulp.task(prepareDebTask.displayName, prepareDebTask); + const buildDebTask = util.task.series(prepareDebTask, buildDebPackage(arch)); + buildDebTask.displayName = `vscode-linux-${arch}-build-deb`; + gulp.task(buildDebTask.displayName, buildDebTask); + } + + { + const rpmArch = getRpmPackageArch(arch); + const prepareRpmTask = util.task.series(util.rimraf(`.build/linux/rpm/${rpmArch}`), prepareRpmPackage(arch)); + prepareRpmTask.displayName = `vscode-linux-${arch}-prepare-rpm`; + // gulp.task(prepareRpmTask.displayName, prepareRpmTask); + const buildRpmTask = util.task.series(prepareRpmTask, buildRpmPackage(arch)); + buildRpmTask.displayName = `vscode-linux-${arch}-build-rpm`; + gulp.task(buildRpmTask.displayName, buildRpmTask); + } + + { + const prepareSnapTask = util.task.series(util.rimraf(`.build/linux/snap/${arch}`), prepareSnapPackage(arch)); + prepareSnapTask.displayName = `vscode-linux-${arch}-prepare-snap`; + gulp.task(prepareSnapTask.displayName, prepareSnapTask); + const buildSnapTask = util.task.series(prepareSnapTask, buildSnapPackage(arch)); + buildSnapTask.displayName = `vscode-linux-${arch}-build-snap`; + gulp.task(buildSnapTask.displayName, buildSnapTask); + } +}); diff --git a/build/gulpfile.vscode.win32.js b/build/gulpfile.vscode.win32.js index 3b3a21c1b69..b49fcbabcfc 100644 --- a/build/gulpfile.vscode.win32.js +++ b/build/gulpfile.vscode.win32.js @@ -134,9 +134,6 @@ function copyInnoUpdater(arch) { }; } -gulp.task('vscode-win32-ia32-copy-inno-updater', copyInnoUpdater('ia32')); -gulp.task('vscode-win32-x64-copy-inno-updater', copyInnoUpdater('x64')); - function patchInnoUpdater(arch) { return cb => { const icon = path.join(repoPath, 'resources', 'win32', 'code.ico'); @@ -144,5 +141,5 @@ function patchInnoUpdater(arch) { }; } -gulp.task('vscode-win32-ia32-inno-updater', ['vscode-win32-ia32-copy-inno-updater'], patchInnoUpdater('ia32')); -gulp.task('vscode-win32-x64-inno-updater', ['vscode-win32-x64-copy-inno-updater'], patchInnoUpdater('x64'));
\ No newline at end of file +gulp.task('vscode-win32-ia32-inno-updater', util.task.series(copyInnoUpdater('ia32'), patchInnoUpdater('ia32'))); +gulp.task('vscode-win32-x64-inno-updater', util.task.series(copyInnoUpdater('x64'), patchInnoUpdater('x64')));
\ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 0f3fc9cc72c..b41fa640399 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,17 +12,27 @@ const gulp = require('gulp'); const util = require('./build/lib/util'); const path = require('path'); const compilation = require('./build/lib/compilation'); +const { monacoTypecheckTask/* , monacoTypecheckWatchTask */ } = require('./build/gulpfile.editor'); +const { compileExtensionsTask, watchExtensionsTask } = require('./build/gulpfile.extensions'); // Fast compile for development time -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))); +const compileClientTask = util.task.series(util.rimraf('out'), compilation.compileTask('src', 'out', false)); +compileClientTask.displayName = 'compile-client'; +gulp.task(compileClientTask.displayName, compileClientTask); -// Default -gulp.task('default', ['compile']); +const watchClientTask = util.task.series(util.rimraf('out'), compilation.watchTask('out', false)); +watchClientTask.displayName = 'watch-client'; +gulp.task(watchClientTask.displayName, watchClientTask); // All -gulp.task('compile', ['monaco-typecheck', 'compile-client', 'compile-extensions']); -gulp.task('watch', [/* 'monaco-typecheck-watch', */ 'watch-client', 'watch-extensions']); +const compileTask = util.task.parallel(monacoTypecheckTask, compileClientTask, compileExtensionsTask); +compileTask.displayName = 'compile'; +gulp.task(compileTask.displayName, compileTask); + +gulp.task('watch', util.task.parallel(/* monacoTypecheckWatchTask, */ watchClientTask, watchExtensionsTask)); + +// Default +gulp.task('default', compileTask); process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); |