2015-11-23 19:28:42 +00:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const gulp = require('gulp');
|
2022-08-15 17:46:34 +00:00
|
|
|
const merge = require('gulp-merge-json');
|
2016-07-20 08:52:46 +00:00
|
|
|
const fs = require('fs');
|
2017-09-11 02:37:57 +00:00
|
|
|
const os = require('os');
|
|
|
|
const cp = require('child_process');
|
2016-07-20 08:52:46 +00:00
|
|
|
const path = require('path');
|
|
|
|
const es = require('event-stream');
|
2016-09-05 10:38:25 +00:00
|
|
|
const vfs = require('vinyl-fs');
|
2016-07-20 08:52:46 +00:00
|
|
|
const rename = require('gulp-rename');
|
|
|
|
const replace = require('gulp-replace');
|
|
|
|
const filter = require('gulp-filter');
|
|
|
|
const util = require('./lib/util');
|
2022-10-05 17:05:40 +00:00
|
|
|
const { getVersion } = require('./lib/getVersion');
|
2019-02-12 14:13:43 +00:00
|
|
|
const task = require('./lib/task');
|
2016-07-20 08:52:46 +00:00
|
|
|
const buildfile = require('../src/buildfile');
|
2022-09-21 07:38:44 +00:00
|
|
|
const optimize = require('./lib/optimize');
|
2016-07-20 08:52:46 +00:00
|
|
|
const root = path.dirname(__dirname);
|
2022-10-05 17:05:40 +00:00
|
|
|
const commit = getVersion(root);
|
2016-07-20 09:00:43 +00:00
|
|
|
const packageJson = require('../package.json');
|
|
|
|
const product = require('../product.json');
|
2016-09-23 07:35:29 +00:00
|
|
|
const crypto = require('crypto');
|
2017-03-02 20:53:02 +00:00
|
|
|
const i18n = require('./lib/i18n');
|
2021-01-21 08:32:06 +00:00
|
|
|
const { getProductionDependencies } = require('./lib/dependencies');
|
2019-10-16 13:35:53 +00:00
|
|
|
const { config } = require('./lib/electron');
|
2018-02-19 09:28:14 +00:00
|
|
|
const createAsar = require('./lib/asar').createAsar;
|
2018-11-22 22:36:01 +00:00
|
|
|
const minimist = require('minimist');
|
2019-02-05 09:03:46 +00:00
|
|
|
const { compileBuildTask } = require('./gulpfile.compile');
|
2021-11-24 12:42:44 +00:00
|
|
|
const { compileExtensionsBuildTask, compileExtensionMediaBuildTask } = require('./gulpfile.extensions');
|
2022-08-20 17:48:18 +00:00
|
|
|
const { promisify } = require('util');
|
|
|
|
const glob = promisify(require('glob'));
|
|
|
|
const rcedit = promisify(require('rcedit'));
|
2016-07-20 08:52:46 +00:00
|
|
|
|
2015-11-23 19:28:42 +00:00
|
|
|
// Build
|
2023-02-03 11:47:51 +00:00
|
|
|
const vscodeEntryPoints = [
|
2019-08-12 10:06:44 +00:00
|
|
|
buildfile.entrypoint('vs/workbench/workbench.desktop.main'),
|
2015-11-23 19:28:42 +00:00
|
|
|
buildfile.base,
|
2020-06-22 08:36:14 +00:00
|
|
|
buildfile.workerExtensionHost,
|
2020-08-25 15:49:55 +00:00
|
|
|
buildfile.workerNotebook,
|
2021-08-06 18:56:14 +00:00
|
|
|
buildfile.workerLanguageDetection,
|
2021-09-20 14:19:53 +00:00
|
|
|
buildfile.workerLocalFileSearch,
|
2022-10-24 15:42:54 +00:00
|
|
|
buildfile.workerProfileAnalysis,
|
2019-08-27 12:59:31 +00:00
|
|
|
buildfile.workbenchDesktop,
|
2016-05-02 13:05:23 +00:00
|
|
|
buildfile.code
|
2023-02-03 11:47:51 +00:00
|
|
|
].flat();
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
const vscodeResources = [
|
2015-11-23 19:28:42 +00:00
|
|
|
'out-build/bootstrap.js',
|
2018-09-07 10:23:09 +00:00
|
|
|
'out-build/bootstrap-fork.js',
|
2016-02-09 14:09:03 +00:00
|
|
|
'out-build/bootstrap-amd.js',
|
2020-06-24 15:43:52 +00:00
|
|
|
'out-build/bootstrap-node.js',
|
2018-09-07 10:23:09 +00:00
|
|
|
'out-build/bootstrap-window.js',
|
2022-08-22 10:48:59 +00:00
|
|
|
'out-build/vs/**/*.{svg,png,html,jpg,mp3}',
|
2019-04-11 10:32:34 +00:00
|
|
|
'!out-build/vs/code/browser/**/*.html',
|
2023-03-25 19:13:59 +00:00
|
|
|
'!out-build/vs/code/**/*-dev.html',
|
2020-07-01 14:39:54 +00:00
|
|
|
'!out-build/vs/editor/standalone/**/*.svg',
|
2017-11-06 17:50:57 +00:00
|
|
|
'out-build/vs/base/common/performance.js',
|
2019-04-11 23:10:52 +00:00
|
|
|
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,cpuUsage.sh,ps.sh}',
|
2020-04-17 11:39:54 +00:00
|
|
|
'out-build/vs/base/browser/ui/codicons/codicon/**',
|
2023-03-28 17:35:58 +00:00
|
|
|
'out-build/vs/base/parts/sandbox/electron-sandbox/preload.js',
|
2023-10-27 14:42:45 +00:00
|
|
|
'out-build/vs/base/parts/sandbox/electron-sandbox/preload-aux.js',
|
2015-11-23 19:28:42 +00:00
|
|
|
'out-build/vs/workbench/browser/media/*-theme.css',
|
2019-02-07 10:48:58 +00:00
|
|
|
'out-build/vs/workbench/contrib/debug/**/*.json',
|
2019-03-05 00:29:20 +00:00
|
|
|
'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt',
|
2023-05-19 22:45:28 +00:00
|
|
|
'out-build/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/*.fish',
|
2022-01-07 18:35:19 +00:00
|
|
|
'out-build/vs/workbench/contrib/terminal/browser/media/*.ps1',
|
|
|
|
'out-build/vs/workbench/contrib/terminal/browser/media/*.sh',
|
2022-02-25 17:19:19 +00:00
|
|
|
'out-build/vs/workbench/contrib/terminal/browser/media/*.zsh',
|
2019-04-02 22:21:35 +00:00
|
|
|
'out-build/vs/workbench/contrib/webview/browser/pre/*.js',
|
2024-05-24 18:36:46 +00:00
|
|
|
'!out-build/vs/workbench/contrib/issue/browser/*.html',
|
|
|
|
'!out-build/vs/workbench/contrib/issue/**/*-dev.html',
|
2016-09-28 14:58:13 +00:00
|
|
|
'out-build/vs/**/markdown.css',
|
2019-02-07 10:48:58 +00:00
|
|
|
'out-build/vs/workbench/contrib/tasks/**/*.json',
|
2015-11-23 19:28:42 +00:00
|
|
|
'!**/test/**'
|
|
|
|
];
|
|
|
|
|
2022-09-21 07:38:44 +00:00
|
|
|
// Do not change the order of these files! They will
|
|
|
|
// be inlined into the target window file in this order
|
|
|
|
// and they depend on each other in this way.
|
|
|
|
const windowBootstrapFiles = [
|
|
|
|
'out-build/bootstrap.js',
|
|
|
|
'out-build/vs/loader.js',
|
|
|
|
'out-build/bootstrap-window.js'
|
|
|
|
];
|
|
|
|
|
2019-02-12 19:43:28 +00:00
|
|
|
const optimizeVSCodeTask = task.define('optimize-vscode', task.series(
|
2019-07-01 13:49:20 +00:00
|
|
|
util.rimraf('out-vscode'),
|
2022-09-21 07:38:44 +00:00
|
|
|
// Optimize: bundles source files automatically based on
|
|
|
|
// AMD and CommonJS import statements based on the passed
|
|
|
|
// in entry points. In addition, concat window related
|
|
|
|
// bootstrap files into a single file.
|
|
|
|
optimize.optimizeTask(
|
|
|
|
{
|
|
|
|
out: 'out-vscode',
|
|
|
|
amd: {
|
|
|
|
src: 'out-build',
|
|
|
|
entryPoints: vscodeEntryPoints,
|
|
|
|
resources: vscodeResources,
|
|
|
|
loaderConfig: optimize.loaderConfig(),
|
|
|
|
bundleInfo: undefined
|
|
|
|
},
|
|
|
|
commonJS: {
|
|
|
|
src: 'out-build',
|
|
|
|
entryPoints: [
|
|
|
|
'out-build/main.js',
|
|
|
|
'out-build/cli.js'
|
|
|
|
],
|
|
|
|
platform: 'node',
|
|
|
|
external: [
|
|
|
|
'electron',
|
|
|
|
'minimist',
|
|
|
|
// TODO: we cannot inline `product.json` because
|
|
|
|
// it is being changed during build time at a later
|
|
|
|
// point in time (such as `checksums`)
|
2022-11-21 10:26:17 +00:00
|
|
|
'../product.json',
|
|
|
|
'../package.json',
|
2022-09-21 07:38:44 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
manual: [
|
|
|
|
{ src: [...windowBootstrapFiles, 'out-build/vs/code/electron-sandbox/workbench/workbench.js'], out: 'vs/code/electron-sandbox/workbench/workbench.js' },
|
2024-05-24 18:36:46 +00:00
|
|
|
// TODO: @justchen https://github.com/microsoft/vscode/issues/213332 make sure to remove when we use window.open on desktop.
|
|
|
|
{ src: [...windowBootstrapFiles, 'out-build/vs/workbench/contrib/issue/electron-sandbox/issueReporter.js'], out: 'vs/workbench/contrib/issue/electron-sandbox/issueReporter.js' },
|
2023-04-03 07:09:31 +00:00
|
|
|
{ src: [...windowBootstrapFiles, 'out-build/vs/code/electron-sandbox/processExplorer/processExplorer.js'], out: 'vs/code/electron-sandbox/processExplorer/processExplorer.js' }
|
2022-09-21 07:38:44 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
)
|
2019-02-12 19:43:28 +00:00
|
|
|
));
|
2019-07-05 15:01:55 +00:00
|
|
|
gulp.task(optimizeVSCodeTask);
|
2019-02-05 17:08:41 +00:00
|
|
|
|
2024-06-03 14:10:01 +00:00
|
|
|
const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
|
2019-07-01 13:49:20 +00:00
|
|
|
const minifyVSCodeTask = task.define('minify-vscode', task.series(
|
2019-02-05 17:08:41 +00:00
|
|
|
optimizeVSCodeTask,
|
2019-07-01 13:49:20 +00:00
|
|
|
util.rimraf('out-vscode-min'),
|
2022-09-21 07:38:44 +00:00
|
|
|
optimize.minifyTask('out-vscode', `${sourceMappingURLBase}/core`)
|
2019-02-12 19:43:28 +00:00
|
|
|
));
|
2019-07-05 15:01:55 +00:00
|
|
|
gulp.task(minifyVSCodeTask);
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2021-01-06 19:37:33 +00:00
|
|
|
const core = task.define('core-ci', task.series(
|
|
|
|
gulp.task('compile-build'),
|
|
|
|
task.parallel(
|
|
|
|
gulp.task('minify-vscode'),
|
|
|
|
gulp.task('minify-vscode-reh'),
|
|
|
|
gulp.task('minify-vscode-reh-web'),
|
|
|
|
)
|
|
|
|
));
|
|
|
|
gulp.task(core);
|
|
|
|
|
2023-06-07 13:51:48 +00:00
|
|
|
const corePr = task.define('core-ci-pr', task.series(
|
|
|
|
gulp.task('compile-build-pr'),
|
|
|
|
task.parallel(
|
|
|
|
gulp.task('minify-vscode'),
|
|
|
|
gulp.task('minify-vscode-reh'),
|
|
|
|
gulp.task('minify-vscode-reh-web'),
|
|
|
|
)
|
|
|
|
));
|
|
|
|
gulp.task(corePr);
|
|
|
|
|
2016-09-23 07:35:29 +00:00
|
|
|
/**
|
|
|
|
* Compute checksums for some files.
|
|
|
|
*
|
|
|
|
* @param {string} out The out folder to read the file from.
|
|
|
|
* @param {string[]} filenames The paths to compute a checksum for.
|
|
|
|
* @return {Object} A map of paths to checksums.
|
|
|
|
*/
|
|
|
|
function computeChecksums(out, filenames) {
|
2022-06-08 15:49:21 +00:00
|
|
|
const result = {};
|
2016-10-11 10:37:34 +00:00
|
|
|
filenames.forEach(function (filename) {
|
2022-06-08 15:49:21 +00:00
|
|
|
const fullPath = path.join(process.cwd(), out, filename);
|
2016-09-23 07:35:29 +00:00
|
|
|
result[filename] = computeChecksum(fullPath);
|
|
|
|
});
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute checksum for a file.
|
|
|
|
*
|
|
|
|
* @param {string} filename The absolute path to a filename.
|
|
|
|
* @return {string} The checksum for `filename`.
|
|
|
|
*/
|
|
|
|
function computeChecksum(filename) {
|
2022-06-08 15:49:21 +00:00
|
|
|
const contents = fs.readFileSync(filename);
|
2016-09-23 07:35:29 +00:00
|
|
|
|
2022-06-08 15:49:21 +00:00
|
|
|
const hash = crypto
|
2024-01-08 13:11:19 +00:00
|
|
|
.createHash('sha256')
|
2016-09-23 07:35:29 +00:00
|
|
|
.update(contents)
|
|
|
|
.digest('base64')
|
|
|
|
.replace(/=+$/, '');
|
|
|
|
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
|
2019-02-05 17:08:41 +00:00
|
|
|
function packageTask(platform, arch, sourceFolderName, destinationFolderName, opts) {
|
2017-05-18 14:02:40 +00:00
|
|
|
opts = opts || {};
|
|
|
|
|
2019-02-05 17:08:41 +00:00
|
|
|
const destination = path.join(path.dirname(root), destinationFolderName);
|
2015-11-23 19:28:42 +00:00
|
|
|
platform = platform || process.platform;
|
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
return () => {
|
2023-04-21 00:15:05 +00:00
|
|
|
const electron = require('@vscode/gulp-electron');
|
2020-12-22 18:55:56 +00:00
|
|
|
const json = require('gulp-json-editor');
|
|
|
|
|
2019-02-05 17:08:41 +00:00
|
|
|
const out = sourceFolderName;
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2016-09-23 07:35:29 +00:00
|
|
|
const checksums = computeChecksums(out, [
|
2023-03-28 17:35:58 +00:00
|
|
|
'vs/base/parts/sandbox/electron-sandbox/preload.js',
|
2019-08-12 10:06:44 +00:00
|
|
|
'vs/workbench/workbench.desktop.main.js',
|
|
|
|
'vs/workbench/workbench.desktop.main.css',
|
2022-01-31 14:58:39 +00:00
|
|
|
'vs/workbench/api/node/extensionHostProcess.js',
|
2022-07-05 07:54:28 +00:00
|
|
|
'vs/code/electron-sandbox/workbench/workbench.html',
|
|
|
|
'vs/code/electron-sandbox/workbench/workbench.js'
|
2016-09-23 07:35:29 +00:00
|
|
|
]);
|
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
const src = gulp.src(out + '/**', { base: '.' })
|
2018-08-21 10:19:10 +00:00
|
|
|
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + out), 'out'); }))
|
2019-07-14 19:21:29 +00:00
|
|
|
.pipe(util.setExecutableBit(['**/*.sh']));
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2020-11-18 10:03:00 +00:00
|
|
|
const platformSpecificBuiltInExtensionsExclusions = product.builtInExtensions.filter(ext => {
|
2020-11-17 14:29:34 +00:00
|
|
|
if (!ext.platforms) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const set = new Set(ext.platforms);
|
|
|
|
return !set.has(platform);
|
|
|
|
}).map(ext => `!.build/extensions/${ext.name}/**`);
|
|
|
|
|
2020-11-18 10:03:00 +00:00
|
|
|
const extensions = gulp.src(['.build/extensions/**', ...platformSpecificBuiltInExtensionsExclusions], { base: '.build', dot: true });
|
2017-06-21 14:17:13 +00:00
|
|
|
|
2019-07-14 19:21:29 +00:00
|
|
|
const sources = es.merge(src, extensions)
|
2019-07-14 19:48:29 +00:00
|
|
|
.pipe(filter(['**', '!**/*.js.map'], { dot: true }));
|
2016-10-11 10:37:34 +00:00
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
let version = packageJson.version;
|
|
|
|
const quality = product.quality;
|
2016-01-20 16:51:01 +00:00
|
|
|
|
|
|
|
if (quality && quality !== 'stable') {
|
|
|
|
version += '-' + quality;
|
|
|
|
}
|
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
const name = product.nameShort;
|
2018-09-13 09:19:59 +00:00
|
|
|
const packageJsonUpdates = { name, version };
|
|
|
|
|
|
|
|
// for linux url handling
|
|
|
|
if (platform === 'linux') {
|
|
|
|
packageJsonUpdates.desktopName = `${product.applicationName}-url-handler.desktop`;
|
|
|
|
}
|
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
const packageJsonStream = gulp.src(['package.json'], { base: '.' })
|
2018-09-13 09:19:59 +00:00
|
|
|
.pipe(json(packageJsonUpdates));
|
2016-07-20 08:52:46 +00:00
|
|
|
|
|
|
|
const date = new Date().toISOString();
|
2022-09-21 07:38:44 +00:00
|
|
|
const productJsonUpdate = { commit, date, checksums, version };
|
2018-07-02 14:37:03 +00:00
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
const productJsonStream = gulp.src(['product.json'], { base: '.' })
|
2018-07-02 14:37:03 +00:00
|
|
|
.pipe(json(productJsonUpdate));
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2023-04-28 22:14:31 +00:00
|
|
|
const license = gulp.src([product.licenseFileName, 'ThirdPartyNotices.txt', 'licenses/**'], { base: '.', allowEmpty: true });
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
// TODO the API should be copied to `out` during compile, not here
|
2021-11-09 14:00:03 +00:00
|
|
|
const api = gulp.src('src/vscode-dts/vscode.d.ts').pipe(rename('out/vscode-dts/vscode.d.ts'));
|
2016-07-20 08:52:46 +00:00
|
|
|
|
2019-06-27 12:40:05 +00:00
|
|
|
const telemetry = gulp.src('.build/telemetry/**', { base: '.build/telemetry', dot: true });
|
|
|
|
|
2020-11-17 14:29:34 +00:00
|
|
|
const jsFilter = util.filter(data => !data.isDirectory() && /\.js$/.test(data.path));
|
2019-07-14 19:21:29 +00:00
|
|
|
const root = path.resolve(path.join(__dirname, '..'));
|
2020-12-14 13:01:43 +00:00
|
|
|
const productionDependencies = getProductionDependencies(root);
|
2023-02-03 11:47:51 +00:00
|
|
|
const dependenciesSrc = productionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`]).flat();
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2019-07-05 15:01:55 +00:00
|
|
|
const deps = gulp.src(dependenciesSrc, { base: '.', dot: true })
|
2021-04-13 19:26:52 +00:00
|
|
|
.pipe(filter(['**', `!**/${config.version}/**`, '!**/bin/darwin-arm64-87/**', '!**/package-lock.json', '!**/yarn.lock', '!**/*.js.map']))
|
2020-10-25 21:35:23 +00:00
|
|
|
.pipe(util.cleanNodeModules(path.join(__dirname, '.moduleignore')))
|
2023-06-09 16:40:10 +00:00
|
|
|
.pipe(util.cleanNodeModules(path.join(__dirname, `.moduleignore.${process.platform}`)))
|
2020-10-26 15:19:40 +00:00
|
|
|
.pipe(jsFilter)
|
|
|
|
.pipe(util.rewriteSourceMappingURL(sourceMappingURLBase))
|
|
|
|
.pipe(jsFilter.restore)
|
2021-05-13 14:10:49 +00:00
|
|
|
.pipe(createAsar(path.join(process.cwd(), 'node_modules'), [
|
|
|
|
'**/*.node',
|
2022-01-11 23:13:24 +00:00
|
|
|
'**/@vscode/ripgrep/bin/*',
|
2021-05-13 14:10:49 +00:00
|
|
|
'**/node-pty/build/Release/*',
|
|
|
|
'**/node-pty/lib/worker/conoutSocketWorker.js',
|
|
|
|
'**/node-pty/lib/shared/conout.js',
|
2021-07-16 23:43:23 +00:00
|
|
|
'**/*.wasm',
|
2024-02-19 08:17:54 +00:00
|
|
|
'**/@vscode/vsce-sign/bin/*',
|
2021-05-13 14:10:49 +00:00
|
|
|
], 'node_modules.asar'));
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
let all = es.merge(
|
2019-06-25 01:47:12 +00:00
|
|
|
packageJsonStream,
|
2016-07-20 08:52:46 +00:00
|
|
|
productJsonStream,
|
2015-11-23 19:28:42 +00:00
|
|
|
license,
|
2016-07-20 08:52:46 +00:00
|
|
|
api,
|
2019-06-27 12:40:05 +00:00
|
|
|
telemetry,
|
2015-11-23 19:28:42 +00:00
|
|
|
sources,
|
2016-02-19 14:35:30 +00:00
|
|
|
deps
|
2016-02-12 14:31:54 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if (platform === 'win32') {
|
2019-01-07 16:16:35 +00:00
|
|
|
all = es.merge(all, gulp.src([
|
|
|
|
'resources/win32/bower.ico',
|
|
|
|
'resources/win32/c.ico',
|
|
|
|
'resources/win32/config.ico',
|
|
|
|
'resources/win32/cpp.ico',
|
|
|
|
'resources/win32/csharp.ico',
|
|
|
|
'resources/win32/css.ico',
|
|
|
|
'resources/win32/default.ico',
|
|
|
|
'resources/win32/go.ico',
|
|
|
|
'resources/win32/html.ico',
|
|
|
|
'resources/win32/jade.ico',
|
|
|
|
'resources/win32/java.ico',
|
|
|
|
'resources/win32/javascript.ico',
|
|
|
|
'resources/win32/json.ico',
|
|
|
|
'resources/win32/less.ico',
|
|
|
|
'resources/win32/markdown.ico',
|
|
|
|
'resources/win32/php.ico',
|
|
|
|
'resources/win32/powershell.ico',
|
|
|
|
'resources/win32/python.ico',
|
|
|
|
'resources/win32/react.ico',
|
|
|
|
'resources/win32/ruby.ico',
|
|
|
|
'resources/win32/sass.ico',
|
|
|
|
'resources/win32/shell.ico',
|
|
|
|
'resources/win32/sql.ico',
|
|
|
|
'resources/win32/typescript.ico',
|
|
|
|
'resources/win32/vue.ico',
|
|
|
|
'resources/win32/xml.ico',
|
|
|
|
'resources/win32/yaml.ico',
|
|
|
|
'resources/win32/code_70x70.png',
|
|
|
|
'resources/win32/code_150x150.png'
|
|
|
|
], { base: '.' }));
|
2016-02-12 14:31:54 +00:00
|
|
|
} else if (platform === 'linux') {
|
|
|
|
all = es.merge(all, gulp.src('resources/linux/code.png', { base: '.' }));
|
2016-02-12 15:55:11 +00:00
|
|
|
} else if (platform === 'darwin') {
|
2016-07-20 08:52:46 +00:00
|
|
|
const shortcut = gulp.src('resources/darwin/bin/code.sh')
|
2022-05-25 14:21:16 +00:00
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
2016-02-12 15:55:11 +00:00
|
|
|
.pipe(rename('bin/code'));
|
|
|
|
|
|
|
|
all = es.merge(all, shortcut);
|
2016-02-12 14:31:54 +00:00
|
|
|
}
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
let result = all
|
2016-02-12 14:31:54 +00:00
|
|
|
.pipe(util.skipDirectories())
|
2015-11-23 19:28:42 +00:00
|
|
|
.pipe(util.fixWin32DirectoryPermissions())
|
2021-02-15 11:57:02 +00:00
|
|
|
.pipe(filter(['**', '!**/.github/**'], { dot: true })) // https://github.com/microsoft/vscode/issues/116523
|
2023-04-13 12:32:24 +00:00
|
|
|
.pipe(electron({ ...config, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: false }))
|
2023-04-28 22:14:31 +00:00
|
|
|
.pipe(filter(['**', '!LICENSE', '!version'], { dot: true }));
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2019-08-12 06:49:19 +00:00
|
|
|
if (platform === 'linux') {
|
|
|
|
result = es.merge(result, gulp.src('resources/completions/bash/code', { base: '.' })
|
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
|
|
|
.pipe(rename(function (f) { f.basename = product.applicationName; })));
|
|
|
|
|
|
|
|
result = es.merge(result, gulp.src('resources/completions/zsh/_code', { base: '.' })
|
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
|
|
|
.pipe(rename(function (f) { f.basename = '_' + product.applicationName; })));
|
|
|
|
}
|
2018-08-17 00:16:45 +00:00
|
|
|
|
2015-11-23 19:28:42 +00:00
|
|
|
if (platform === 'win32') {
|
2019-02-06 09:15:36 +00:00
|
|
|
result = es.merge(result, gulp.src('resources/win32/bin/code.js', { base: 'resources/win32', allowEmpty: true }));
|
2016-01-27 14:41:54 +00:00
|
|
|
|
2016-02-25 15:58:27 +00:00
|
|
|
result = es.merge(result, gulp.src('resources/win32/bin/code.cmd', { base: 'resources/win32' })
|
2016-02-25 16:35:33 +00:00
|
|
|
.pipe(replace('@@NAME@@', product.nameShort))
|
2016-02-25 15:53:28 +00:00
|
|
|
.pipe(rename(function (f) { f.basename = product.applicationName; })));
|
|
|
|
|
2016-02-25 15:58:27 +00:00
|
|
|
result = es.merge(result, gulp.src('resources/win32/bin/code.sh', { base: 'resources/win32' })
|
2016-02-25 15:53:28 +00:00
|
|
|
.pipe(replace('@@NAME@@', product.nameShort))
|
2019-04-10 14:46:24 +00:00
|
|
|
.pipe(replace('@@PRODNAME@@', product.nameLong))
|
|
|
|
.pipe(replace('@@VERSION@@', version))
|
2018-11-08 20:59:23 +00:00
|
|
|
.pipe(replace('@@COMMIT@@', commit))
|
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
2022-01-24 13:43:30 +00:00
|
|
|
.pipe(replace('@@SERVERDATAFOLDER@@', product.serverDataFolderName || '.vscode-remote'))
|
2019-04-12 12:01:12 +00:00
|
|
|
.pipe(replace('@@QUALITY@@', quality))
|
2016-02-25 15:53:28 +00:00
|
|
|
.pipe(rename(function (f) { f.basename = product.applicationName; f.extname = ''; })));
|
2017-09-05 06:00:59 +00:00
|
|
|
|
|
|
|
result = es.merge(result, gulp.src('resources/win32/VisualElementsManifest.xml', { base: 'resources/win32' })
|
2017-09-05 08:47:34 +00:00
|
|
|
.pipe(rename(product.nameShort + '.VisualElementsManifest.xml')));
|
2022-04-20 14:34:41 +00:00
|
|
|
|
2022-06-15 07:56:48 +00:00
|
|
|
result = es.merge(result, gulp.src('.build/policies/win32/**', { base: '.build/policies/win32' })
|
|
|
|
.pipe(rename(f => f.dirname = `policies/${f.dirname}`)));
|
|
|
|
|
2022-10-21 18:17:30 +00:00
|
|
|
if (quality === 'insider') {
|
|
|
|
result = es.merge(result, gulp.src('.build/win32/appx/**', { base: '.build/win32' }));
|
|
|
|
}
|
2016-04-05 21:50:59 +00:00
|
|
|
} else if (platform === 'linux') {
|
|
|
|
result = es.merge(result, gulp.src('resources/linux/bin/code.sh', { base: '.' })
|
2019-04-10 14:46:24 +00:00
|
|
|
.pipe(replace('@@PRODNAME@@', product.nameLong))
|
2022-05-25 14:21:16 +00:00
|
|
|
.pipe(replace('@@APPNAME@@', product.applicationName))
|
2016-04-05 21:50:59 +00:00
|
|
|
.pipe(rename('bin/' + product.applicationName)));
|
2015-11-23 19:28:42 +00:00
|
|
|
}
|
|
|
|
|
2016-09-05 10:38:25 +00:00
|
|
|
return result.pipe(vfs.dest(destination));
|
2015-11-23 19:28:42 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-08-20 17:48:18 +00:00
|
|
|
function patchWin32DependenciesTask(destinationFolderName) {
|
|
|
|
const cwd = path.join(path.dirname(root), destinationFolderName);
|
|
|
|
|
|
|
|
return async () => {
|
|
|
|
const deps = await glob('**/*.node', { cwd });
|
|
|
|
const packageJson = JSON.parse(await fs.promises.readFile(path.join(cwd, 'resources', 'app', 'package.json'), 'utf8'));
|
|
|
|
const product = JSON.parse(await fs.promises.readFile(path.join(cwd, 'resources', 'app', 'product.json'), 'utf8'));
|
|
|
|
const baseVersion = packageJson.version.replace(/-.*$/, '');
|
|
|
|
|
|
|
|
await Promise.all(deps.map(async dep => {
|
|
|
|
const basename = path.basename(dep);
|
|
|
|
|
|
|
|
await rcedit(path.join(cwd, dep), {
|
|
|
|
'file-version': baseVersion,
|
|
|
|
'version-string': {
|
|
|
|
'CompanyName': 'Microsoft Corporation',
|
|
|
|
'FileDescription': product.nameLong,
|
|
|
|
'FileVersion': packageJson.version,
|
|
|
|
'InternalName': basename,
|
|
|
|
'LegalCopyright': 'Copyright (C) 2022 Microsoft. All rights reserved',
|
|
|
|
'OriginalFilename': basename,
|
|
|
|
'ProductName': product.nameLong,
|
|
|
|
'ProductVersion': packageJson.version,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-07-20 08:52:46 +00:00
|
|
|
const buildRoot = path.dirname(root);
|
|
|
|
|
2019-02-05 17:08:41 +00:00
|
|
|
const BUILD_TARGETS = [
|
|
|
|
{ platform: 'win32', arch: 'x64' },
|
2020-04-14 11:26:29 +00:00
|
|
|
{ platform: 'win32', arch: 'arm64' },
|
2020-11-23 23:31:03 +00:00
|
|
|
{ platform: 'darwin', arch: 'x64', opts: { stats: true } },
|
|
|
|
{ platform: 'darwin', arch: 'arm64', opts: { stats: true } },
|
2019-02-05 17:08:41 +00:00
|
|
|
{ platform: 'linux', arch: 'x64' },
|
2020-09-08 07:41:28 +00:00
|
|
|
{ platform: 'linux', arch: 'armhf' },
|
2019-02-05 17:08:41 +00:00
|
|
|
{ platform: 'linux', arch: 'arm64' },
|
|
|
|
];
|
|
|
|
BUILD_TARGETS.forEach(buildTarget => {
|
|
|
|
const dashed = (str) => (str ? `-${str}` : ``);
|
|
|
|
const platform = buildTarget.platform;
|
|
|
|
const arch = buildTarget.arch;
|
|
|
|
const opts = buildTarget.opts;
|
|
|
|
|
2020-12-04 15:50:44 +00:00
|
|
|
const [vscode, vscodeMin] = ['', 'min'].map(minified => {
|
2019-02-05 17:08:41 +00:00
|
|
|
const sourceFolderName = `out-vscode${dashed(minified)}`;
|
|
|
|
const destinationFolderName = `VSCode${dashed(platform)}${dashed(arch)}`;
|
|
|
|
|
2022-08-20 17:48:18 +00:00
|
|
|
const tasks = [
|
2019-07-01 13:49:20 +00:00
|
|
|
util.rimraf(path.join(buildRoot, destinationFolderName)),
|
2019-02-05 17:08:41 +00:00
|
|
|
packageTask(platform, arch, sourceFolderName, destinationFolderName, opts)
|
2022-08-20 17:48:18 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
if (platform === 'win32') {
|
|
|
|
tasks.push(patchWin32DependenciesTask(destinationFolderName));
|
|
|
|
}
|
|
|
|
|
|
|
|
const vscodeTaskCI = task.define(`vscode${dashed(platform)}${dashed(arch)}${dashed(minified)}-ci`, task.series(...tasks));
|
2019-07-01 13:49:20 +00:00
|
|
|
gulp.task(vscodeTaskCI);
|
2019-07-01 10:24:33 +00:00
|
|
|
|
|
|
|
const vscodeTask = task.define(`vscode${dashed(platform)}${dashed(arch)}${dashed(minified)}`, task.series(
|
2019-07-01 13:49:20 +00:00
|
|
|
compileBuildTask,
|
2019-07-01 10:24:33 +00:00
|
|
|
compileExtensionsBuildTask,
|
2021-11-24 12:42:44 +00:00
|
|
|
compileExtensionMediaBuildTask,
|
2019-07-05 15:01:55 +00:00
|
|
|
minified ? minifyVSCodeTask : optimizeVSCodeTask,
|
2019-07-01 13:49:20 +00:00
|
|
|
vscodeTaskCI
|
2019-07-01 10:24:33 +00:00
|
|
|
));
|
2019-02-12 19:43:28 +00:00
|
|
|
gulp.task(vscodeTask);
|
2020-12-04 15:50:44 +00:00
|
|
|
|
|
|
|
return vscodeTask;
|
2019-02-05 17:08:41 +00:00
|
|
|
});
|
2020-12-04 15:50:44 +00:00
|
|
|
|
|
|
|
if (process.platform === platform && process.arch === arch) {
|
|
|
|
gulp.task(task.define('vscode', task.series(vscode)));
|
|
|
|
gulp.task(task.define('vscode-min', task.series(vscodeMin)));
|
|
|
|
}
|
2019-02-05 17:08:41 +00:00
|
|
|
});
|
2015-11-23 19:28:42 +00:00
|
|
|
|
2022-08-15 17:46:34 +00:00
|
|
|
// #region nls
|
|
|
|
|
2018-01-25 20:13:24 +00:00
|
|
|
const innoSetupConfig = {
|
|
|
|
'zh-cn': { codePage: 'CP936', defaultInfo: { name: 'Simplified Chinese', id: '$0804', } },
|
|
|
|
'zh-tw': { codePage: 'CP950', defaultInfo: { name: 'Traditional Chinese', id: '$0404' } },
|
|
|
|
'ko': { codePage: 'CP949', defaultInfo: { name: 'Korean', id: '$0412' } },
|
|
|
|
'ja': { codePage: 'CP932' },
|
|
|
|
'de': { codePage: 'CP1252' },
|
|
|
|
'fr': { codePage: 'CP1252' },
|
|
|
|
'es': { codePage: 'CP1252' },
|
|
|
|
'ru': { codePage: 'CP1251' },
|
|
|
|
'it': { codePage: 'CP1252' },
|
|
|
|
'pt-br': { codePage: 'CP1252' },
|
|
|
|
'hu': { codePage: 'CP1250' },
|
|
|
|
'tr': { codePage: 'CP1254' }
|
|
|
|
};
|
2017-04-05 16:12:24 +00:00
|
|
|
|
2019-02-12 19:43:28 +00:00
|
|
|
gulp.task(task.define(
|
|
|
|
'vscode-translations-export',
|
2019-02-12 14:13:43 +00:00
|
|
|
task.series(
|
2022-08-15 17:46:34 +00:00
|
|
|
core,
|
2019-07-11 07:44:52 +00:00
|
|
|
compileExtensionsBuildTask,
|
2019-02-05 20:23:25 +00:00
|
|
|
function () {
|
|
|
|
const pathToMetadata = './out-vscode/nls.metadata.json';
|
2022-08-15 17:46:34 +00:00
|
|
|
const pathToRehWebMetadata = './out-vscode-reh-web/nls.metadata.json';
|
2019-09-04 06:05:36 +00:00
|
|
|
const pathToExtensions = '.build/extensions/*';
|
2021-05-31 13:40:30 +00:00
|
|
|
const pathToSetup = 'build/win32/i18n/messages.en.isl';
|
2019-02-05 20:23:25 +00:00
|
|
|
|
|
|
|
return es.merge(
|
2022-08-17 03:58:17 +00:00
|
|
|
gulp.src([pathToMetadata, pathToRehWebMetadata]).pipe(merge({
|
2022-08-15 17:46:34 +00:00
|
|
|
fileName: 'nls.metadata.json',
|
|
|
|
jsonSpace: '',
|
|
|
|
concatArrays: true
|
|
|
|
})).pipe(i18n.createXlfFilesForCoreBundle()),
|
2019-02-05 20:23:25 +00:00
|
|
|
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
|
|
|
|
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
|
|
|
|
).pipe(vfs.dest('../vscode-translations-export'));
|
|
|
|
}
|
|
|
|
)
|
2019-02-12 19:43:28 +00:00
|
|
|
));
|
2018-01-25 20:13:24 +00:00
|
|
|
|
2017-05-16 16:12:27 +00:00
|
|
|
gulp.task('vscode-translations-import', function () {
|
2022-06-08 15:49:21 +00:00
|
|
|
const options = minimist(process.argv.slice(2), {
|
2018-11-22 22:36:01 +00:00
|
|
|
string: 'location',
|
|
|
|
default: {
|
|
|
|
location: '../vscode-translations-import'
|
|
|
|
}
|
|
|
|
});
|
2018-08-27 14:47:11 +00:00
|
|
|
return es.merge([...i18n.defaultLanguages, ...i18n.extraLanguages].map(language => {
|
2022-06-08 15:49:21 +00:00
|
|
|
const id = language.id;
|
2021-05-31 13:40:30 +00:00
|
|
|
return gulp.src(`${options.location}/${id}/vscode-setup/messages.xlf`)
|
2018-01-25 20:13:24 +00:00
|
|
|
.pipe(i18n.prepareIslFiles(language, innoSetupConfig[language.id]))
|
|
|
|
.pipe(vfs.dest(`./build/win32/i18n`));
|
2018-08-27 14:47:11 +00:00
|
|
|
}));
|
2017-03-02 20:53:02 +00:00
|
|
|
});
|
2022-08-15 17:46:34 +00:00
|
|
|
|
|
|
|
// #endregion
|