Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)

This commit is contained in:
Cory Rivera
2021-08-25 16:28:29 -07:00
committed by GitHub
parent ab1112bfb3
commit cb7b7da0a4
1752 changed files with 59525 additions and 33878 deletions

View File

@@ -9,39 +9,52 @@ exports.dirs = [
'build',
'build/lib/watch',
'extensions',
// {{SQL CARBON EDIT}} Add ADS extensions and remove VSCode ones
'extensions/admin-tool-ext-win',
'extensions/agent',
'extensions/arc',
'extensions/azcli',
'extensions/azurecore',
'extensions/azurehybridtoolkit',
'extensions/azuremonitor',
'extensions/big-data-cluster',
'extensions/cms',
'extensions/configuration-editing',
'extensions/css-language-features',
'extensions/css-language-features/server',
'extensions/debug-auto-launch',
'extensions/debug-server-ready',
'extensions/emmet',
'extensions/dacpac',
'extensions/data-workspace',
'extensions/extension-editing',
'extensions/git',
'extensions/github',
'extensions/github-authentication',
'extensions/grunt',
'extensions/gulp',
'extensions/html-language-features',
'extensions/html-language-features/server',
'extensions/image-preview',
'extensions/jake',
'extensions/import',
'extensions/integration-tests',
'extensions/json-language-features',
'extensions/json-language-features/server',
'extensions/kusto',
'extensions/liveshare',
'extensions/machine-learning',
'extensions/markdown-language-features',
'extensions/markdown-math',
'extensions/merge-conflict',
'extensions/microsoft-authentication',
'extensions/notebook-markdown-extensions',
'extensions/npm',
'extensions/php-language-features',
'extensions/mssql',
'extensions/notebook',
'extensions/profiler',
'extensions/python',
'extensions/query-history',
'extensions/resource-deployment',
'extensions/schema-compare',
'extensions/search-result',
'extensions/server-report',
'extensions/simple-browser',
'extensions/sql-assessment',
'extensions/sql-database-projects',
'extensions/sql-migration',
'extensions/testing-editor-contributions',
'extensions/typescript-language-features',
'extensions/vscode-api-tests',
'extensions/vscode-colorize-tests',
'extensions/vscode-custom-editor-tests',
'extensions/vscode-notebook-tests',
'extensions/vscode-test-resolver',
'extensions/xml-language-features',
// {{SQL CARBON EDIT}} - End
'remote',
'remote/web',
'test/automation',

View File

@@ -6,6 +6,7 @@
const cp = require('child_process');
const path = require('path');
const fs = require('fs');
const { dirs } = require('./dirs');
const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
/**
@@ -21,6 +22,10 @@ function yarnInstall(location, opts) {
const argv = JSON.parse(raw);
const original = argv.original || [];
const args = original.filter(arg => arg === '--ignore-optional' || arg === '--frozen-lockfile');
if (opts.ignoreEngines) {
args.push('--ignore-engines');
delete opts.ignoreEngines;
}
console.log(`Installing dependencies in ${location}...`);
console.log(`$ yarn ${args.join(' ')}`);
@@ -31,24 +36,39 @@ function yarnInstall(location, opts) {
}
}
yarnInstall('extensions'); // node modules shared by all extensions
for (let dir of dirs) {
if (!(process.platform === 'win32' && (process.arch === 'arm64' || process.env['npm_config_arch'] === 'arm64'))) {
yarnInstall('remote'); // node modules used by vscode server
yarnInstall('remote/web'); // node modules used by vscode web
}
const allExtensionFolders = fs.readdirSync('extensions');
const extensions = allExtensionFolders.filter(e => {
try {
let packageJSON = JSON.parse(fs.readFileSync(path.join('extensions', e, 'package.json')).toString());
return packageJSON && (packageJSON.dependencies || packageJSON.devDependencies);
} catch (e) {
return false;
if (dir === '') {
// `yarn` already executed in root
continue;
}
});
extensions.forEach(extension => yarnInstall(`extensions/${extension}`));
if (/^remote/.test(dir) && process.platform === 'win32' && (process.arch === 'arm64' || process.env['npm_config_arch'] === 'arm64')) {
// windows arm: do not execute `yarn` on remote folder
continue;
}
if (dir === 'build/lib/watch') {
// node modules for watching, specific to host node version, not electron
yarnInstallBuildDependencies();
continue;
}
let opts;
if (dir === 'remote') {
// node modules used by vscode server
const env = { ...process.env };
if (process.env['VSCODE_REMOTE_CC']) { env['CC'] = process.env['VSCODE_REMOTE_CC']; }
if (process.env['VSCODE_REMOTE_CXX']) { env['CXX'] = process.env['VSCODE_REMOTE_CXX']; }
if (process.env['VSCODE_REMOTE_NODE_GYP']) { env['npm_config_node_gyp'] = process.env['VSCODE_REMOTE_NODE_GYP']; }
opts = { env };
} else if (/^extensions\//.test(dir)) {
opts = { ignoreEngines: true };
}
yarnInstall(dir, opts);
}
function yarnInstallBuildDependencies() {
// make sure we install the deps of build/lib/watch for the system installed
@@ -68,10 +88,4 @@ runtime "${runtime}"`;
yarnInstall(watchPath);
}
yarnInstall(`build`); // node modules required for build
yarnInstall('test/automation'); // node modules required for smoketest
yarnInstall('test/smoke'); // node modules required for smoketest
yarnInstall('test/integration/browser'); // node modules required for integration
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
cp.execSync('git config pull.rebase true');

View File

@@ -20,19 +20,12 @@ function update(options) {
if (!idOrPath) {
throw new Error('Argument must be the location of the localization extension.');
}
let transifex = options.transifex;
let location = options.location;
if (transifex === true && location !== undefined) {
throw new Error('Either --transifex or --location can be specified, but not both.');
}
if (!transifex && !location) {
transifex = true;
}
if (location !== undefined && !fs.existsSync(location)) {
throw new Error(`${location} doesn't exist.`);
}
let locExtFolder = idOrPath;
if (/^\w{2}(-\w+)?$/.test(idOrPath)) {
if (/^\w{2,3}(-\w+)?$/.test(idOrPath)) {
locExtFolder = path.join('..', 'vscode-loc', 'i18n', `vscode-language-pack-${idOrPath}`);
}
let locExtStat = fs.statSync(locExtFolder);
@@ -53,79 +46,55 @@ function update(options) {
if (!localization.languageId || !localization.languageName || !localization.localizedLanguageName) {
throw new Error('Each localization contribution must define "languageId", "languageName" and "localizedLanguageName" properties.');
}
let server = localization.server || 'www.transifex.com';
let userName = localization.userName || 'api';
let apiToken = process.env.TRANSIFEX_API_TOKEN;
let languageId = localization.transifexId || localization.languageId;
let languageId = localization.languageId;
let translationDataFolder = path.join(locExtFolder, 'translations');
if (languageId === "zh-cn") {
languageId = "zh-hans";
}
if (languageId === "zh-tw") {
languageId = "zh-hant";
switch (languageId) {
case 'zh-cn':
languageId = 'zh-Hans';
break;
case 'zh-tw':
languageId = 'zh-Hant';
break;
case 'pt-br':
languageId = 'pt-BR';
break;
}
if (fs.existsSync(translationDataFolder) && fs.existsSync(path.join(translationDataFolder, 'main.i18n.json'))) {
console.log('Clearing \'' + translationDataFolder + '\'...');
rimraf.sync(translationDataFolder);
}
if (transifex) {
console.log(`Downloading translations for ${languageId} to '${translationDataFolder}' ...`);
let translationPaths = [];
i18n.pullI18nPackFiles(server, userName, apiToken, { id: languageId }, translationPaths)
.on('error', (error) => {
console.log(`Error occurred while importing translations:`);
translationPaths = undefined;
if (Array.isArray(error)) {
error.forEach(console.log);
} else if (error) {
console.log(error);
} else {
console.log('Unknown error');
console.log(`Importing translations for ${languageId} form '${location}' to '${translationDataFolder}' ...`);
let translationPaths = [];
gulp.src(path.join(location, '**', languageId, '*.xlf'), { silent: false })
.pipe(i18n.prepareI18nPackFiles(i18n.externalExtensionsWithTranslations, translationPaths, languageId === 'ps'))
.on('error', (error) => {
console.log(`Error occurred while importing translations:`);
translationPaths = undefined;
if (Array.isArray(error)) {
error.forEach(console.log);
} else if (error) {
console.log(error);
} else {
console.log('Unknown error');
}
})
.pipe(vfs.dest(translationDataFolder))
.on('end', function () {
if (translationPaths !== undefined) {
localization.translations = [];
for (let tp of translationPaths) {
localization.translations.push({ id: tp.id, path: `./translations/${tp.resourceName}` });
}
})
.pipe(vfs.dest(translationDataFolder))
.on('end', function () {
if (translationPaths !== undefined) {
localization.translations = [];
for (let tp of translationPaths) {
localization.translations.push({ id: tp.id, path: `./translations/${tp.resourceName}`});
}
fs.writeFileSync(path.join(locExtFolder, 'package.json'), JSON.stringify(packageJSON, null, '\t'));
}
});
} else {
console.log(`Importing translations for ${languageId} form '${location}' to '${translationDataFolder}' ...`);
let translationPaths = [];
gulp.src(path.join(location, languageId, '**', '*.xlf'))
.pipe(i18n.prepareI18nPackFiles(i18n.externalExtensionsWithTranslations, translationPaths, languageId === 'ps'))
.on('error', (error) => {
console.log(`Error occurred while importing translations:`);
translationPaths = undefined;
if (Array.isArray(error)) {
error.forEach(console.log);
} else if (error) {
console.log(error);
} else {
console.log('Unknown error');
}
})
.pipe(vfs.dest(translationDataFolder))
.on('end', function () {
if (translationPaths !== undefined) {
localization.translations = [];
for (let tp of translationPaths) {
localization.translations.push({ id: tp.id, path: `./translations/${tp.resourceName}`});
}
fs.writeFileSync(path.join(locExtFolder, 'package.json'), JSON.stringify(packageJSON, null, '\t'));
}
});
}
fs.writeFileSync(path.join(locExtFolder, 'package.json'), JSON.stringify(packageJSON, null, '\t') + '\n');
}
});
});
}
if (path.basename(process.argv[1]) === 'update-localization-extension.js') {
var options = minimist(process.argv.slice(2), {
boolean: 'transifex',
string: 'location'
});
update(options);