Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,441 changes: 2,101 additions & 2,340 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"minimist": "1.2.0",
"mocha": "5.0.4",
"mocha-typescript": "1.1.12",
"mock-fs": "^4.7.0",
"mock-http-server": "0.2.0",
"npm-run-all": "4.1.2",
"nyc": "11.8.0",
Expand All @@ -140,10 +141,11 @@
"typescript": "2.8.3",
"unzip2": "0.2.5",
"vsce": "1.40.0",
"vscode": "1.1.18"
"vscode": "^1.1.21"
},
"runtimeDependencies": [
{
"id": "OmniSharp",
"description": "OmniSharp for Windows (.NET 4.6 / x86)",
"url": "https://download.visualstudio.microsoft.com/download/pr/515dbb33-d644-4ba6-9ee4-8ca7227ab580/02621f196a581cb3062dbeab2ec28429/omnisharp-win-x86-1.32.8.zip",
"fallbackUrl": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x86-1.32.8.zip",
Expand All @@ -158,6 +160,7 @@
"platformId": "win-x86"
},
{
"id": "OmniSharp",
"description": "OmniSharp for Windows (.NET 4.6 / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/515dbb33-d644-4ba6-9ee4-8ca7227ab580/bdfde5788994e381c9a3efe5777081bd/omnisharp-win-x64-1.32.8.zip",
"fallbackUrl": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x64-1.32.8.zip",
Expand All @@ -172,6 +175,7 @@
"platformId": "win-x64"
},
{
"id": "OmniSharp",
"description": "OmniSharp for OSX",
"url": "https://download.visualstudio.microsoft.com/download/pr/515dbb33-d644-4ba6-9ee4-8ca7227ab580/dcead54f3e2dcc736d0ca1cbfde2ad0c/omnisharp-osx-1.32.8.zip",
"fallbackUrl": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-osx-1.32.8.zip",
Expand All @@ -187,6 +191,7 @@
"platformId": "osx"
},
{
"id": "OmniSharp",
"description": "OmniSharp for Linux (x86)",
"url": "https://download.visualstudio.microsoft.com/download/pr/515dbb33-d644-4ba6-9ee4-8ca7227ab580/ac9dde43e4905a8481c35f557fe09502/omnisharp-linux-x86-1.32.8.zip",
"fallbackUrl": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-linux-x86-1.32.8.zip",
Expand All @@ -206,6 +211,7 @@
"platformId": "linux-x86"
},
{
"id": "OmniSharp",
"description": "OmniSharp for Linux (x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/515dbb33-d644-4ba6-9ee4-8ca7227ab580/ee3801c7083438b5e54fa7405662565a/omnisharp-linux-x64-1.32.8.zip",
"fallbackUrl": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-linux-x64-1.32.8.zip",
Expand All @@ -224,6 +230,7 @@
"platformId": "linux-x64"
},
{
"id": "Debugger",
"description": ".NET Core Debugger (Windows / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/90e2038c-960d-4018-924e-30f520f887ab/117523c7024fbf6ffef530b707d7253a/coreclr-debug-win7-x64.zip",
"fallbackUrl": "https://vsdebugger.blob.core.windows.net/coreclr-debug-1-17-1/coreclr-debug-win7-x64.zip",
Expand All @@ -237,6 +244,7 @@
"installTestPath": "./.debugger/vsdbg-ui.exe"
},
{
"id": "Debugger",
"description": ".NET Core Debugger (macOS / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/90e2038c-960d-4018-924e-30f520f887ab/2d53db027d1e67b899a7f083800b2bd4/coreclr-debug-osx-x64.zip",
"fallbackUrl": "https://vsdebugger.blob.core.windows.net/coreclr-debug-1-17-1/coreclr-debug-osx-x64.zip",
Expand All @@ -254,6 +262,7 @@
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"id": "Debugger",
"description": ".NET Core Debugger (linux / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/90e2038c-960d-4018-924e-30f520f887ab/090d7ebd63a3d44b31cb23568b53833d/coreclr-debug-linux-x64.zip",
"fallbackUrl": "https://vsdebugger.blob.core.windows.net/coreclr-debug-1-17-1/coreclr-debug-linux-x64.zip",
Expand All @@ -271,6 +280,7 @@
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"id": "Razor",
"description": "Razor Language Server (Windows / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/3b0ae709-c067-48b4-a658-549ca972e437/bbd021dbeab477395f37f1c4e39c31ad/razorlanguageserver-win-x64-1.0.0-alpha2-20181112.3.zip",
"installPath": ".razor",
Expand All @@ -282,6 +292,7 @@
]
},
{
"id": "Razor",
"description": "Razor Language Server (Windows / x86)",
"url": "https://download.visualstudio.microsoft.com/download/pr/3b0ae709-c067-48b4-a658-549ca972e437/d4196db447b32b655910532321f4bd6a/razorlanguageserver-win-x86-1.0.0-alpha2-20181112.3.zip",
"installPath": ".razor",
Expand All @@ -293,6 +304,7 @@
]
},
{
"id": "Razor",
"description": "Razor Language Server (Linux / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/3b0ae709-c067-48b4-a658-549ca972e437/ad6d340d6d68e760bb1bb7a8073051f3/razorlanguageserver-linux-x64-1.0.0-alpha2-20181112.3.zip",
"installPath": ".razor",
Expand All @@ -307,6 +319,7 @@
]
},
{
"id": "Razor",
"description": "Razor Language Server (macOS / x64)",
"url": "https://download.visualstudio.microsoft.com/download/pr/3b0ae709-c067-48b4-a658-549ca972e437/e4808fd370ba60d528944a5a36543cf0/razorlanguageserver-osx-x64-1.0.0-alpha2-20181112.3.zip",
"installPath": ".razor",
Expand Down
15 changes: 1 addition & 14 deletions src/CSharpExtDownloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as util from './common';
import { PlatformInformation } from './platform';
import { PackageInstallation, LogPlatformInfo, InstallationSuccess, InstallationFailure } from './omnisharp/loggingEvents';
import { PackageInstallation, LogPlatformInfo, InstallationSuccess } from './omnisharp/loggingEvents';
import { EventStream } from './EventStream';
import { DownloadAndInstallPackages } from './packageManager/PackageManager';
import { Package } from './packageManager/Package';
Expand All @@ -26,30 +25,18 @@ export class CSharpExtDownloader {

public async installRuntimeDependencies(): Promise<boolean> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are now always calling this method when the C# extension starts right? If so, shouldn't we avoid posting some of these events to the event stream until after we have determined if there are any missing packages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gregg-miskelly You are right, but with the current code structure it is not possible and we will need some refactoring in order to achieve that. I will do that in a subsequent PR.

this.eventStream.post(new PackageInstallation("C# dependencies"));
let installationStage = 'touchBeginFile';

try {
await util.touchInstallFile(util.InstallFileType.Begin);
// Display platform information and RID
this.eventStream.post(new LogPlatformInfo(this.platformInfo));
let runTimeDependencies = GetRunTimeDependenciesPackages(this.packageJSON);
installationStage = 'downloadAndInstallPackages';
await DownloadAndInstallPackages(runTimeDependencies, this.networkSettingsProvider, this.platformInfo, this.eventStream, this.extensionPath);
installationStage = 'touchLockFile';
await util.touchInstallFile(util.InstallFileType.Lock);
this.eventStream.post(new InstallationSuccess());
return true;
}
catch (error) {
this.eventStream.post(new InstallationFailure(installationStage, error));
return false;
}
finally {
try {
util.deleteInstallFile(util.InstallFileType.Begin);
}
catch (error) { }
}
}
}

Expand Down
17 changes: 9 additions & 8 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as cp from 'child_process';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import { AbsolutePath } from './packageManager/AbsolutePath';

let extensionPath: string;

Expand Down Expand Up @@ -129,18 +130,18 @@ export enum InstallFileType {
Lock
}

function getInstallFilePath(type: InstallFileType): string {
export function getInstallFilePath(folderPath: AbsolutePath, type: InstallFileType): string {
let installFile = 'install.' + InstallFileType[type];
return path.resolve(getExtensionPath(), installFile);
return path.resolve(folderPath.value, installFile);
}

export async function installFileExists(type: InstallFileType): Promise<boolean> {
return fileExists(getInstallFilePath(type));
export async function installFileExists(folderPath: AbsolutePath, type: InstallFileType): Promise<boolean> {
return fileExists(getInstallFilePath(folderPath, type));
}

export async function touchInstallFile(type: InstallFileType): Promise<void> {
export async function touchInstallFile(folderPath: AbsolutePath, type: InstallFileType): Promise<void> {
return new Promise<void>((resolve, reject) => {
fs.writeFile(getInstallFilePath(type), '', err => {
fs.writeFile(getInstallFilePath(folderPath, type), '', err => {
if (err) {
reject(err);
return;
Expand All @@ -151,9 +152,9 @@ export async function touchInstallFile(type: InstallFileType): Promise<void> {
});
}

export async function deleteInstallFile(type: InstallFileType): Promise<void> {
export async function deleteInstallFile(folderPath: AbsolutePath, type: InstallFileType): Promise<void> {
return new Promise<void>((resolve, reject) => {
fs.unlink(getInstallFilePath(type), err => {
fs.unlink(getInstallFilePath(folderPath, type), err => {
if (err) {
reject(err);
return;
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr-debug/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { PlatformInformation } from './../platform';
import { DebuggerPrerequisiteWarning, DebuggerPrerequisiteFailure, DebuggerNotInstalledFailure } from '../omnisharp/loggingEvents';
import { EventStream } from '../EventStream';
import CSharpExtensionExports from '../CSharpExtensionExports';
import { getRuntimeDependencyPackageWithId } from '../tools/GetRuntimeDependencyWithId';

let _debugUtil: CoreClrDebugUtil = null;

Expand Down Expand Up @@ -112,7 +113,7 @@ interface AdapterExecutableCommand {
// The default extension manifest calls this command as the adapterExecutableCommand
// If the debugger components have not finished downloading, the proxy displays an error message to the user
// Else it will launch the debug adapter
export async function getAdapterExecutionCommand(platformInfo: PlatformInformation, eventStream: EventStream): Promise<AdapterExecutableCommand> {
export async function getAdapterExecutionCommand(platformInfo: PlatformInformation, eventStream: EventStream, packageJSON: any, extensionPath: string): Promise<AdapterExecutableCommand> {
let util = new CoreClrDebugUtil(common.getExtensionPath());

// Check for .debugger folder. Handle if it does not exist.
Expand All @@ -125,7 +126,13 @@ export async function getAdapterExecutionCommand(platformInfo: PlatformInformati
// 4. install.complete is created

// install.Lock does not exist, need to wait for packages to finish downloading.
let installLock: boolean = await common.installFileExists(common.InstallFileType.Lock);
let installLock = false;
let debuggerPackage = getRuntimeDependencyPackageWithId("Debugger", packageJSON, platformInfo, extensionPath);
if (debuggerPackage && debuggerPackage.installPath)
{
installLock = await common.installFileExists(debuggerPackage.installPath, common.InstallFileType.Lock);
}

if (!installLock) {
eventStream.post(new DebuggerNotInstalledFailure());
throw new Error('The C# extension is still downloading packages. Please see progress in the output window below.');
Expand Down
6 changes: 3 additions & 3 deletions src/features/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import reportIssue from './reportIssue';
import { IMonoResolver } from '../constants/IMonoResolver';
import { getDotnetInfo } from '../utils/getDotnetInfo';

export default function registerCommands(server: OmniSharpServer, platformInfo: PlatformInformation, eventStream: EventStream, optionProvider: OptionProvider, monoResolver: IMonoResolver): CompositeDisposable {
export default function registerCommands(server: OmniSharpServer, platformInfo: PlatformInformation, eventStream: EventStream, optionProvider: OptionProvider, monoResolver: IMonoResolver, packageJSON: any, extensionPath: string): CompositeDisposable {
let disposable = new CompositeDisposable();
disposable.add(vscode.commands.registerCommand('o.restart', () => restartOmniSharp(server)));
disposable.add(vscode.commands.registerCommand('o.pickProjectAndStart', async () => pickProjectAndStart(server, optionProvider)));
Expand All @@ -47,8 +47,8 @@ export default function registerCommands(server: OmniSharpServer, platformInfo:
disposable.add(vscode.commands.registerCommand('csharp.listRemoteProcess', async (args) => RemoteAttachPicker.ShowAttachEntries(args, platformInfo)));

// Register command for adapter executable command.
disposable.add(vscode.commands.registerCommand('csharp.coreclrAdapterExecutableCommand', async (args) => getAdapterExecutionCommand(platformInfo, eventStream)));
disposable.add(vscode.commands.registerCommand('csharp.clrAdapterExecutableCommand', async (args) => getAdapterExecutionCommand(platformInfo, eventStream)));
disposable.add(vscode.commands.registerCommand('csharp.coreclrAdapterExecutableCommand', async (args) => getAdapterExecutionCommand(platformInfo, eventStream, packageJSON, extensionPath)));
disposable.add(vscode.commands.registerCommand('csharp.clrAdapterExecutableCommand', async (args) => getAdapterExecutionCommand(platformInfo, eventStream, packageJSON, extensionPath)));
disposable.add(vscode.commands.registerCommand('csharp.reportIssue', async () => reportIssue(vscode, eventStream, getDotnetInfo, platformInfo.isValidPlatformForMono(), optionProvider.GetLatestOptions(), monoResolver)));

return new CompositeDisposable(disposable);
Expand Down
11 changes: 2 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CSharp
}

async function ensureRuntimeDependencies(extension: vscode.Extension<CSharpExtensionExports>, eventStream: EventStream, platformInfo: PlatformInformation, networkSettingsProvider: NetworkSettingsProvider): Promise<boolean> {
return util.installFileExists(util.InstallFileType.Lock)
.then(exists => {
if (!exists) {
const downloader = new CSharpExtDownloader(networkSettingsProvider, eventStream, extension.packageJSON, platformInfo, extension.extensionPath);
return downloader.installRuntimeDependencies();
} else {
return true;
}
});
const downloader = new CSharpExtDownloader(networkSettingsProvider, eventStream, extension.packageJSON, platformInfo, extension.extensionPath);
return downloader.installRuntimeDependencies();
}

2 changes: 1 addition & 1 deletion src/omnisharp/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function activate(context: vscode.ExtensionContext, packageJSON: an
localDisposables = null;
}));

disposables.add(registerCommands(server, platformInfo, eventStream, optionProvider, omnisharpMonoResolver));
disposables.add(registerCommands(server, platformInfo, eventStream, optionProvider, omnisharpMonoResolver, packageJSON, extensionPath));

if (!context.workspaceState.get<boolean>('assetPromptDisabled')) {
disposables.add(server.onServerStart(() => {
Expand Down
4 changes: 3 additions & 1 deletion src/packageManager/AbsolutePathPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { IPackage } from "./IPackage";
import { AbsolutePath } from "./AbsolutePath";

export class AbsolutePathPackage implements IPackage{
constructor(public description: string,
constructor(public id: string,
public description: string,
public url: string,
public platforms: string[],
public architectures: string[],
Expand All @@ -21,6 +22,7 @@ export class AbsolutePathPackage implements IPackage{

public static getAbsolutePathPackage(pkg: Package, extensionPath: string) {
return new AbsolutePathPackage(
pkg.id,
pkg.description,
pkg.url,
pkg.platforms,
Expand Down
1 change: 1 addition & 0 deletions src/packageManager/IPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/

export interface IPackage {
id: string;
description: string;
url: string;
fallbackUrl?: string;
Expand Down
10 changes: 5 additions & 5 deletions src/packageManager/PackageFilterer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function filterPackages(packages: AbsolutePathPackage[], platformIn
return filterAlreadyInstalledPackages(platformPackages);
}

function filterPlatformPackages(packages: AbsolutePathPackage[], platformInfo: PlatformInformation) {
export function filterPlatformPackages(packages: AbsolutePathPackage[], platformInfo: PlatformInformation) {
if (packages) {
return packages.filter(pkg => {
if (pkg.architectures && pkg.architectures.indexOf(platformInfo.architecture) === -1) {
Expand All @@ -36,13 +36,13 @@ function filterPlatformPackages(packages: AbsolutePathPackage[], platformInfo: P

async function filterAlreadyInstalledPackages(packages: AbsolutePathPackage[]): Promise<AbsolutePathPackage[]> {
return filterAsync(packages, async (pkg: AbsolutePathPackage) => {
//If the file is present at the install test path then filter it
let testPath = pkg.installTestPath;
//If the install.Lock file is present for this package then do not install it again
let testPath = util.getInstallFilePath(pkg.installPath, util.InstallFileType.Lock);
if (!testPath) {
//if there is no testPath specified then we will not filter it
//if there is no testPath then we will not filter it
return true;
}

return !(await util.fileExists(testPath.value));
return !(await util.fileExists(testPath));
});
}
Loading