mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 03:28:33 -05:00
Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 (#12295)
* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 * Fix test build break * Update distro * Fix build errors * Update distro * Update REH build file * Update build task names for REL * Fix product build yaml * Fix product REH task name * Fix type in task name * Update linux build step * Update windows build tasks * Turn off server publish * Disable REH * Fix typo * Bump distro * Update vscode tests * Bump distro * Fix type in disto * Bump distro * Turn off docker build * Remove docker step from release Co-authored-by: ADS Merger <andresse@microsoft.com> Co-authored-by: Karl Burtram <karlb@microsoft.com>
This commit is contained in:
@@ -6,104 +6,7 @@
|
||||
import * as minimist from 'minimist';
|
||||
import { localize } from 'vs/nls';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
|
||||
export interface ParsedArgs {
|
||||
_: string[];
|
||||
'folder-uri'?: string[]; // undefined or array of 1 or more
|
||||
'file-uri'?: string[]; // undefined or array of 1 or more
|
||||
_urls?: string[];
|
||||
help?: boolean;
|
||||
version?: boolean;
|
||||
telemetry?: boolean;
|
||||
status?: boolean;
|
||||
wait?: boolean;
|
||||
waitMarkerFilePath?: string;
|
||||
diff?: boolean;
|
||||
add?: boolean;
|
||||
goto?: boolean;
|
||||
'new-window'?: boolean;
|
||||
'unity-launch'?: boolean; // Always open a new window, except if opening the first window or opening a file or folder as part of the launch.
|
||||
'reuse-window'?: boolean;
|
||||
locale?: string;
|
||||
'user-data-dir'?: string;
|
||||
'prof-startup'?: boolean;
|
||||
'prof-startup-prefix'?: string;
|
||||
'prof-append-timers'?: string;
|
||||
verbose?: boolean;
|
||||
trace?: boolean;
|
||||
'trace-category-filter'?: string;
|
||||
'trace-options'?: string;
|
||||
'open-devtools'?: boolean;
|
||||
log?: string;
|
||||
logExtensionHostCommunication?: boolean;
|
||||
'extensions-dir'?: string;
|
||||
'extensions-download-dir'?: string;
|
||||
'builtin-extensions-dir'?: string;
|
||||
extensionDevelopmentPath?: string[]; // // undefined or array of 1 or more local paths or URIs
|
||||
extensionTestsPath?: string; // either a local path or a URI
|
||||
'inspect-extensions'?: string;
|
||||
'inspect-brk-extensions'?: string;
|
||||
debugId?: string;
|
||||
'inspect-search'?: string;
|
||||
'inspect-brk-search'?: string;
|
||||
'disable-extensions'?: boolean;
|
||||
'disable-extension'?: string[]; // undefined or array of 1 or more
|
||||
'list-extensions'?: boolean;
|
||||
'show-versions'?: boolean;
|
||||
'category'?: string;
|
||||
'install-extension'?: string[]; // undefined or array of 1 or more
|
||||
'uninstall-extension'?: string[]; // undefined or array of 1 or more
|
||||
'locate-extension'?: string[]; // undefined or array of 1 or more
|
||||
'enable-proposed-api'?: string[]; // undefined or array of 1 or more
|
||||
'open-url'?: boolean;
|
||||
'skip-release-notes'?: boolean;
|
||||
'disable-restore-windows'?: boolean;
|
||||
'disable-telemetry'?: boolean;
|
||||
'export-default-configuration'?: string;
|
||||
'install-source'?: string;
|
||||
'disable-updates'?: boolean;
|
||||
'disable-crash-reporter'?: boolean;
|
||||
'crash-reporter-directory'?: string;
|
||||
'crash-reporter-id'?: string;
|
||||
'skip-add-to-recently-opened'?: boolean;
|
||||
'max-memory'?: string;
|
||||
'file-write'?: boolean;
|
||||
'file-chmod'?: boolean;
|
||||
'driver'?: string;
|
||||
'driver-verbose'?: boolean;
|
||||
'remote'?: string;
|
||||
'disable-user-env-probe'?: boolean;
|
||||
'force'?: boolean;
|
||||
'do-not-sync'?: boolean;
|
||||
'force-user-env'?: boolean;
|
||||
'sync'?: 'on' | 'off';
|
||||
'__sandbox'?: boolean;
|
||||
|
||||
// {{SQL CARBON EDIT}} Start
|
||||
aad?: boolean;
|
||||
database?: string;
|
||||
integrated?: boolean;
|
||||
server?: string;
|
||||
user?: string;
|
||||
command?: string;
|
||||
// {{SQL CARBON EDIT}} End
|
||||
|
||||
// chromium command line args: https://electronjs.org/docs/all#supported-chrome-command-line-switches
|
||||
'no-proxy-server'?: boolean;
|
||||
'proxy-server'?: string;
|
||||
'proxy-bypass-list'?: string;
|
||||
'proxy-pac-url'?: string;
|
||||
'inspect'?: string;
|
||||
'inspect-brk'?: string;
|
||||
'js-flags'?: string;
|
||||
'disable-gpu'?: boolean;
|
||||
'nolazy'?: boolean;
|
||||
'force-device-scale-factor'?: string;
|
||||
'force-renderer-accessibility'?: boolean;
|
||||
'ignore-certificate-errors'?: boolean;
|
||||
'allow-insecure-localhost'?: boolean;
|
||||
'log-net-log'?: string;
|
||||
}
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
|
||||
/**
|
||||
* This code is also used by standalone cli's. Avoid adding any other dependencies.
|
||||
@@ -134,7 +37,7 @@ type OptionTypeName<T> =
|
||||
T extends undefined ? 'undefined' :
|
||||
'unknown';
|
||||
|
||||
export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
|
||||
export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'diff': { type: 'boolean', cat: 'o', alias: 'd', args: ['file', 'file'], description: localize('diff', "Compare two files with each other.") },
|
||||
'add': { type: 'boolean', cat: 'o', alias: 'a', args: 'folder', description: localize('add', "Add folder(s) to the last active window.") },
|
||||
'goto': { type: 'boolean', cat: 'o', alias: 'g', args: 'file:line[:character]', description: localize('goto', "Open a file at the path on the specified line and character position.") },
|
||||
@@ -423,4 +326,3 @@ export function buildHelpMessage(productName: string, executableName: string, ve
|
||||
export function buildVersionMessage(version: string | undefined, commit: string | undefined): string {
|
||||
return `${version || localize('unknownVersion', "Unknown version")}\n${commit || localize('unknownCommit', "Unknown commit")}\n${process.arch}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { localize } from 'vs/nls';
|
||||
import { MIN_MAX_MEMORY_SIZE_MB } from 'vs/platform/files/common/files';
|
||||
import { parseArgs, ErrorReporter, OPTIONS, ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
import { parseArgs, ErrorReporter, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
|
||||
function parseAndValidate(cmdLineArgs: string[], reportWarnings: boolean): ParsedArgs {
|
||||
function parseAndValidate(cmdLineArgs: string[], reportWarnings: boolean): NativeParsedArgs {
|
||||
const errorReporter: ErrorReporter = {
|
||||
onUnknownOption: (id) => {
|
||||
console.warn(localize('unknownOption', "Warning: '{0}' is not in the list of known options, but still passed to Electron/Chromium.", id));
|
||||
@@ -32,7 +32,7 @@ function parseAndValidate(cmdLineArgs: string[], reportWarnings: boolean): Parse
|
||||
}
|
||||
|
||||
function stripAppPath(argv: string[]): string[] | undefined {
|
||||
const index = firstIndex(argv, a => !/^-/.test(a));
|
||||
const index = argv.findIndex(a => !/^-/.test(a));
|
||||
|
||||
if (index > -1) {
|
||||
return [...argv.slice(0, index), ...argv.slice(index + 1)];
|
||||
@@ -43,7 +43,7 @@ function stripAppPath(argv: string[]): string[] | undefined {
|
||||
/**
|
||||
* Use this to parse raw code process.argv such as: `Electron . --verbose --wait`
|
||||
*/
|
||||
export function parseMainProcessArgv(processArgv: string[]): ParsedArgs {
|
||||
export function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs {
|
||||
let [, ...args] = processArgv;
|
||||
|
||||
// If dev, remove the first non-option argument: it's the app location
|
||||
@@ -59,7 +59,7 @@ export function parseMainProcessArgv(processArgv: string[]): ParsedArgs {
|
||||
/**
|
||||
* Use this to parse raw code CLI process.argv such as: `Electron cli.js . --verbose --wait`
|
||||
*/
|
||||
export function parseCLIProcessArgv(processArgv: string[]): ParsedArgs {
|
||||
export function parseCLIProcessArgv(processArgv: string[]): NativeParsedArgs {
|
||||
let [, , ...args] = processArgv;
|
||||
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IEnvironmentService, IDebugParams, IExtensionHostDebugParams, BACKUPS } from 'vs/platform/environment/common/environment';
|
||||
import { ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
import { IDebugParams, IExtensionHostDebugParams, INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import * as crypto from 'crypto';
|
||||
import * as paths from 'vs/base/node/paths';
|
||||
import * as os from 'os';
|
||||
@@ -13,54 +13,19 @@ import * as resources from 'vs/base/common/resources';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { toLocalISOString } from 'vs/base/common/date';
|
||||
import { isWindows, isLinux, Platform, platform } from 'vs/base/common/platform';
|
||||
import { isWindows, Platform, platform } from 'vs/base/common/platform';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export interface INativeEnvironmentService extends IEnvironmentService {
|
||||
args: ParsedArgs;
|
||||
|
||||
appRoot: string;
|
||||
execPath: string;
|
||||
|
||||
appSettingsHome: URI;
|
||||
userDataPath: string;
|
||||
userHome: URI;
|
||||
machineSettingsResource: URI;
|
||||
backupWorkspacesPath: string;
|
||||
nodeCachedDataDir?: string;
|
||||
|
||||
mainIPCHandle: string;
|
||||
sharedIPCHandle: string;
|
||||
|
||||
installSourcePath: string;
|
||||
|
||||
extensionsPath?: string;
|
||||
extensionsDownloadPath: string;
|
||||
builtinExtensionsPath: string;
|
||||
|
||||
driverHandle?: string;
|
||||
driverVerbose: boolean;
|
||||
|
||||
disableUpdates: boolean;
|
||||
|
||||
sandbox: boolean;
|
||||
}
|
||||
|
||||
export class EnvironmentService implements INativeEnvironmentService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
get args(): ParsedArgs { return this._args; }
|
||||
get args(): NativeParsedArgs { return this._args; }
|
||||
|
||||
@memoize
|
||||
get appRoot(): string { return path.dirname(getPathFromAmdModule(require, '')); }
|
||||
|
||||
get execPath(): string { return this._execPath; }
|
||||
|
||||
@memoize
|
||||
get cliPath(): string { return getCLIPath(this.execPath, this.appRoot, this.isBuilt); }
|
||||
|
||||
readonly logsPath: string;
|
||||
|
||||
@memoize
|
||||
@@ -129,10 +94,10 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
get isExtensionDevelopment(): boolean { return !!this._args.extensionDevelopmentPath; }
|
||||
|
||||
@memoize
|
||||
get backupHome(): URI { return URI.file(path.join(this.userDataPath, BACKUPS)); }
|
||||
get backupHome(): string { return path.join(this.userDataPath, 'Backups'); }
|
||||
|
||||
@memoize
|
||||
get backupWorkspacesPath(): string { return path.join(this.backupHome.fsPath, 'workspaces.json'); }
|
||||
get backupWorkspacesPath(): string { return path.join(this.backupHome, 'workspaces.json'); }
|
||||
|
||||
@memoize
|
||||
get untitledWorkspacesHome(): URI { return URI.file(path.join(this.userDataPath, 'Workspaces')); }
|
||||
@@ -222,22 +187,8 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
return false;
|
||||
}
|
||||
|
||||
get extensionEnabledProposedApi(): string[] | undefined {
|
||||
if (Array.isArray(this.args['enable-proposed-api'])) {
|
||||
return this.args['enable-proposed-api'];
|
||||
}
|
||||
|
||||
if ('enable-proposed-api' in this.args) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@memoize
|
||||
get debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostPort(this._args, this.isBuilt); }
|
||||
@memoize
|
||||
get logExtensionHostCommunication(): boolean { return !!this.args.logExtensionHostCommunication; }
|
||||
|
||||
get isBuilt(): boolean { return !process.env['VSCODE_DEV']; }
|
||||
get verbose(): boolean { return !!this._args.verbose; }
|
||||
@@ -266,7 +217,7 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
|
||||
get sandbox(): boolean { return !!this._args['__sandbox']; }
|
||||
|
||||
constructor(private _args: ParsedArgs, private _execPath: string) {
|
||||
constructor(private _args: NativeParsedArgs) {
|
||||
if (!process.env['VSCODE_LOGS']) {
|
||||
const key = toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '');
|
||||
process.env['VSCODE_LOGS'] = path.join(this.userDataPath, 'logs', key);
|
||||
@@ -327,39 +278,11 @@ function getIPCHandle(userDataPath: string, type: string): string {
|
||||
return getNixIPCHandle(userDataPath, type);
|
||||
}
|
||||
|
||||
function getCLIPath(execPath: string, appRoot: string, isBuilt: boolean): string {
|
||||
|
||||
// Windows
|
||||
if (isWindows) {
|
||||
if (isBuilt) {
|
||||
return path.join(path.dirname(execPath), 'bin', `${product.applicationName}.cmd`);
|
||||
}
|
||||
|
||||
return path.join(appRoot, 'scripts', 'code-cli.bat');
|
||||
}
|
||||
|
||||
// Linux
|
||||
if (isLinux) {
|
||||
if (isBuilt) {
|
||||
return path.join(path.dirname(execPath), 'bin', `${product.applicationName}`);
|
||||
}
|
||||
|
||||
return path.join(appRoot, 'scripts', 'code-cli.sh');
|
||||
}
|
||||
|
||||
// macOS
|
||||
if (isBuilt) {
|
||||
return path.join(appRoot, 'bin', 'code');
|
||||
}
|
||||
|
||||
return path.join(appRoot, 'scripts', 'code-cli.sh');
|
||||
}
|
||||
|
||||
export function parseExtensionHostPort(args: ParsedArgs, isBuild: boolean): IExtensionHostDebugParams {
|
||||
export function parseExtensionHostPort(args: NativeParsedArgs, isBuild: boolean): IExtensionHostDebugParams {
|
||||
return parseDebugPort(args['inspect-extensions'], args['inspect-brk-extensions'], 5870, isBuild, args.debugId);
|
||||
}
|
||||
|
||||
export function parseSearchPort(args: ParsedArgs, isBuild: boolean): IDebugParams {
|
||||
export function parseSearchPort(args: NativeParsedArgs, isBuild: boolean): IDebugParams {
|
||||
return parseDebugPort(args['inspect-search'], args['inspect-brk-search'], 5876, isBuild);
|
||||
}
|
||||
|
||||
@@ -387,6 +310,6 @@ export function parsePathArg(arg: string | undefined, process: NodeJS.Process):
|
||||
return path.resolve(process.env['VSCODE_CWD'] || process.cwd(), arg);
|
||||
}
|
||||
|
||||
export function parseUserDataDir(args: ParsedArgs, process: NodeJS.Process): string {
|
||||
export function parseUserDataDir(args: NativeParsedArgs, process: NodeJS.Process): string {
|
||||
return parsePathArg(args['user-data-dir'], process) || path.resolve(paths.getDefaultUserDataPath(process.platform));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user