Vscode merge (#4582)

* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd

* fix issues with merges

* bump node version in azpipe

* replace license headers

* remove duplicate launch task

* fix build errors

* fix build errors

* fix tslint issues

* working through package and linux build issues

* more work

* wip

* fix packaged builds

* working through linux build errors

* wip

* wip

* wip

* fix mac and linux file limits

* iterate linux pipeline

* disable editor typing

* revert series to parallel

* remove optimize vscode from linux

* fix linting issues

* revert testing change

* add work round for new node

* readd packaging for extensions

* fix issue with angular not resolving decorator dependencies
This commit is contained in:
Anthony Dresser
2019-03-19 17:44:35 -07:00
committed by GitHub
parent 833d197412
commit 87765e8673
1879 changed files with 54505 additions and 38058 deletions

View File

@@ -3,14 +3,14 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as path from 'vs/base/common/path';
import * as fs from 'fs';
import * as cp from 'child_process';
import * as nls from 'vs/nls';
import * as Types from 'vs/base/common/types';
import { IStringDictionary } from 'vs/base/common/collections';
import * as Objects from 'vs/base/common/objects';
import * as TPath from 'vs/base/common/paths';
import * as extpath from 'vs/base/common/extpath';
import * as Platform from 'vs/base/common/platform';
import { LineDecoder } from 'vs/base/node/decoder';
import { CommandOptions, ForkOptions, SuccessData, Source, TerminateResponse, TerminateResponseCode, Executable } from 'vs/base/common/processes';
@@ -42,7 +42,7 @@ function getWindowsCode(status: number): TerminateResponseCode {
export function terminateProcess(process: cp.ChildProcess, cwd?: string): TerminateResponse {
if (Platform.isWindows) {
try {
let options: any = {
const options: any = {
stdio: ['pipe', 'pipe', 'ignore']
};
if (cwd) {
@@ -54,8 +54,8 @@ export function terminateProcess(process: cp.ChildProcess, cwd?: string): Termin
}
} else if (Platform.isLinux || Platform.isMacintosh) {
try {
let cmd = getPathFromAmdModule(require, 'vs/base/node/terminateProcess.sh');
let result = cp.spawnSync(cmd, [process.pid.toString()]);
const cmd = getPathFromAmdModule(require, 'vs/base/node/terminateProcess.sh');
const result = cp.spawnSync(cmd, [process.pid.toString()]);
if (result.error) {
return { success: false, error: result.error };
}
@@ -72,26 +72,6 @@ export function getWindowsShell(): string {
return process.env['comspec'] || 'cmd.exe';
}
/**
* Sanitizes a VS Code process environment by removing all Electron/VS Code-related values.
*/
export function sanitizeProcessEnvironment(env: Platform.IProcessEnvironment): void {
const keysToRemove = [
/^ELECTRON_.+$/,
/^GOOGLE_API_KEY$/,
/^VSCODE_.+$/
];
const envKeys = Object.keys(env);
envKeys.forEach(envKey => {
for (let i = 0; i < keysToRemove.length; i++) {
if (envKey.search(keysToRemove[i]) !== -1) {
delete env[envKey];
break;
}
}
});
}
export abstract class AbstractProcess<TProgressData> {
private cmd: string;
private args: string[];
@@ -133,7 +113,7 @@ export abstract class AbstractProcess<TProgressData> {
this.shell = arg3;
this.options = arg4;
} else {
let executable = <Executable>arg1;
const executable = <Executable>arg1;
this.cmd = executable.command;
this.shell = executable.isShellCommand;
this.args = executable.args.slice(0);
@@ -144,7 +124,7 @@ export abstract class AbstractProcess<TProgressData> {
this.terminateRequested = false;
if (this.options.env) {
let newEnv: IStringDictionary<string> = Object.create(null);
const newEnv: IStringDictionary<string> = Object.create(null);
Object.keys(process.env).forEach((key) => {
newEnv[key] = process.env[key]!;
});
@@ -157,7 +137,7 @@ export abstract class AbstractProcess<TProgressData> {
public getSanitizedCommand(): string {
let result = this.cmd.toLowerCase();
let index = result.lastIndexOf(path.sep);
const index = result.lastIndexOf(path.sep);
if (index !== -1) {
result = result.substring(index + 1);
}
@@ -168,13 +148,13 @@ export abstract class AbstractProcess<TProgressData> {
}
public start(pp: ProgressCallback<TProgressData>): Promise<SuccessData> {
if (Platform.isWindows && ((this.options && this.options.cwd && TPath.isUNC(this.options.cwd)) || !this.options && TPath.isUNC(process.cwd()))) {
if (Platform.isWindows && ((this.options && this.options.cwd && extpath.isUNC(this.options.cwd)) || !this.options && extpath.isUNC(process.cwd()))) {
return Promise.reject(new Error(nls.localize('TaskRunner.UNC', 'Can\'t execute a shell command on a UNC drive.')));
}
return this.useExec().then((useExec) => {
let cc: ValueCallback<SuccessData>;
let ee: ErrorCallback;
let result = new Promise<any>((c, e) => {
const result = new Promise<any>((c, e) => {
cc = c;
ee = e;
});
@@ -186,7 +166,7 @@ export abstract class AbstractProcess<TProgressData> {
}
this.childProcess = cp.exec(cmd, this.options, (error, stdout, stderr) => {
this.childProcess = null;
let err: any = error;
const err: any = error;
// This is tricky since executing a command shell reports error back in case the executed command return an
// error or the command didn't exist at all. So we can't blindly treat an error as a failed command. So we
// always parse the output and report success unless the job got killed.
@@ -198,11 +178,11 @@ export abstract class AbstractProcess<TProgressData> {
});
} else {
let childProcess: cp.ChildProcess | null = null;
let closeHandler = (data: any) => {
const closeHandler = (data: any) => {
this.childProcess = null;
this.childProcessPromise = null;
this.handleClose(data, cc, pp, ee);
let result: SuccessData = {
const result: SuccessData = {
terminated: this.terminateRequested
};
if (Types.isNumber(data)) {
@@ -211,12 +191,12 @@ export abstract class AbstractProcess<TProgressData> {
cc(result);
};
if (this.shell && Platform.isWindows) {
let options: any = Objects.deepClone(this.options);
const options: any = Objects.deepClone(this.options);
options.windowsVerbatimArguments = true;
options.detached = false;
let quotedCommand: boolean = false;
let quotedArg: boolean = false;
let commandLine: string[] = [];
const commandLine: string[] = [];
let quoted = this.ensureQuotes(this.cmd);
commandLine.push(quoted.value);
quotedCommand = quoted.quoted;
@@ -227,7 +207,7 @@ export abstract class AbstractProcess<TProgressData> {
quotedArg = quotedArg && quoted.quoted;
});
}
let args: string[] = [
const args: string[] = [
'/s',
'/c',
];
@@ -307,7 +287,7 @@ export abstract class AbstractProcess<TProgressData> {
}
return this.childProcessPromise.then((childProcess) => {
this.terminateRequested = true;
let result = terminateProcess(childProcess, this.options.cwd);
const result = terminateProcess(childProcess, this.options.cwd);
if (result.success) {
this.childProcess = null;
}
@@ -320,14 +300,14 @@ export abstract class AbstractProcess<TProgressData> {
private useExec(): Promise<boolean> {
return new Promise<boolean>((c, e) => {
if (!this.shell || !Platform.isWindows) {
c(false);
return c(false);
}
let cmdShell = cp.spawn(getWindowsShell(), ['/s', '/c']);
const cmdShell = cp.spawn(getWindowsShell(), ['/s', '/c']);
cmdShell.on('error', (error: Error) => {
c(true);
return c(true);
});
cmdShell.on('exit', (data: any) => {
c(false);
return c(false);
});
});
}
@@ -346,12 +326,12 @@ export class LineProcess extends AbstractProcess<LineData> {
protected handleExec(cc: ValueCallback<SuccessData>, pp: ProgressCallback<LineData>, error: Error, stdout: Buffer, stderr: Buffer) {
[stdout, stderr].forEach((buffer: Buffer, index: number) => {
let lineDecoder = new LineDecoder();
let lines = lineDecoder.write(buffer);
const lineDecoder = new LineDecoder();
const lines = lineDecoder.write(buffer);
lines.forEach((line) => {
pp({ line: line, source: index === 0 ? Source.stdout : Source.stderr });
});
let line = lineDecoder.end();
const line = lineDecoder.end();
if (line) {
pp({ line: line, source: index === 0 ? Source.stdout : Source.stderr });
}
@@ -363,11 +343,11 @@ export class LineProcess extends AbstractProcess<LineData> {
this.stdoutLineDecoder = new LineDecoder();
this.stderrLineDecoder = new LineDecoder();
childProcess.stdout.on('data', (data: Buffer) => {
let lines = this.stdoutLineDecoder.write(data);
const lines = this.stdoutLineDecoder.write(data);
lines.forEach(line => pp({ line: line, source: Source.stdout }));
});
childProcess.stderr.on('data', (data: Buffer) => {
let lines = this.stderrLineDecoder.write(data);
const lines = this.stderrLineDecoder.write(data);
lines.forEach(line => pp({ line: line, source: Source.stderr }));
});
}
@@ -400,7 +380,7 @@ export function createQueuedSender(childProcess: cp.ChildProcess): IQueuedSender
return;
}
let result = childProcess.send(msg, (error: Error) => {
const result = childProcess.send(msg, (error: Error) => {
if (error) {
console.error(error); // unlikely to happen, best we can do is log this error
}
@@ -432,7 +412,7 @@ export namespace win32 {
if (cwd === undefined) {
cwd = process.cwd();
}
let dir = path.dirname(command);
const dir = path.dirname(command);
if (dir !== '.') {
// We have a directory and the directory is relative (see above). Make the path absolute
// to the current working directory.
@@ -469,4 +449,4 @@ export namespace win32 {
}
return path.join(cwd, command);
}
}
}