Skip to content

Commit

Permalink
Improve dependancy handling / Linux distro handling (#1371)
Browse files Browse the repository at this point in the history
* Improve dependancy handling / Linux distro handling

#1361
#1323

Changes:
1. Add a setting to control what version of the debugger to use on Linux
2. We no longer automaticially select a debugger on Arch. Instead, we point folks to a web page telling them how to install it.
3. Added logic to the package manager so that it can detect if a package is already installed so it will not be redownloaded. This was needed since I wanted to trigger redownloads in the case that the user added the Linux distro setting. But it seemed like a useful feature anyway for folks on slow internet connections.
4. Moved the install code to its own .ts file

* Updates to the changelog

* Code review fixes

* Restore original whitespace in package.json

* Remove 'runtime id' from the install log
  • Loading branch information
gregg-miskelly authored Apr 7, 2017
1 parent 6be1bc0 commit 610c50d
Show file tree
Hide file tree
Showing 9 changed files with 536 additions and 250 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@

#### Debugger

* **Arch Linux change**: before, the debugger would automatically use the Ubuntu 16 debugger on Arch. Now we require the debugger to be explicitly set. See https://aka.ms/vscode-csext-arch for more information.
* Several bug fixes that addressed problems with launch ([#1318](https://github.com/OmniSharp/omnisharp-vscode/issues/1318), [#1335](https://github.com/OmniSharp/omnisharp-vscode/issues/1335), [#1336](https://github.com/OmniSharp/omnisharp-vscode/issues/1336))
* Fix issue where VS Code would incorrectly display threads as paused ([#1317](https://github.com/OmniSharp/omnisharp-vscode/issues/1317))
* Added new 'csharp.fallbackDebuggerLinuxRuntimeId' configuration setting to control the version of the debugger used on Linux ([#1361](https://github.com/OmniSharp/omnisharp-vscode/issues/1361)).

#### Other Updates and Fixes

* Improvements made to project.json package completion experience. ([#1338](https://github.com/OmniSharp/omnisharp-vscode/pull/1338))
* Assets for building and debugging are now always generated with POSIX style paths. ([#1354](https://github.com/OmniSharp/omnisharp-vscode/pull/1354))
* Improved the extension's runtime dependency download logic to skip re-downloading packages that were already successfully downloaded and installed.

## 1.8.1 (March 31, 2017)

Expand Down
73 changes: 54 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"binaries": [
"./mono.linux-x86",
"./run"
]
],
"installTestPath": "./bin/mono.linux-x86"
},
{
"description": "Mono Runtime (Linux / x64)",
Expand All @@ -94,7 +95,8 @@
"binaries": [
"./mono.linux-x86_64",
"./run"
]
],
"installTestPath": "./bin/mono.linux-x86_64"
},
{
"description": "Mono Runtime (macOS)",
Expand All @@ -106,7 +108,8 @@
"binaries": [
"./mono.osx",
"./run"
]
],
"installTestPath": "./bin/mono.osx"
},
{
"description": "Mono Framework Assemblies",
Expand All @@ -115,7 +118,8 @@
"platforms": [
"darwin",
"linux"
]
],
"installTestPath": "./bin/framework/mscorlib.dll"
},
{
"description": "OmniSharp (.NET 4.6 / x86)",
Expand All @@ -126,7 +130,8 @@
],
"architectures": [
"x86"
]
],
"installTestPath": "./bin/omnisharp/OmniSharp.exe"
},
{
"description": "OmniSharp (.NET 4.6 / x64)",
Expand All @@ -137,7 +142,8 @@
],
"architectures": [
"x86_64"
]
],
"installTestPath": "./bin/omnisharp/OmniSharp.exe"
},
{
"description": "OmniSharp (Mono 4.6)",
Expand All @@ -146,7 +152,8 @@
"platforms": [
"darwin",
"linux"
]
],
"installTestPath": "./bin/omnisharp/OmniSharp.exe"
},
{
"description": ".NET Core Debugger (Windows / x64)",
Expand All @@ -155,7 +162,8 @@
"installPath": ".debugger",
"runtimeIds": [
"win7-x64"
]
],
"installTestPath": "./.debugger/vsdbg-ui.exe"
},
{
"description": ".NET Core Debugger (macOS / x64)",
Expand All @@ -168,7 +176,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (CentOS / x64)",
Expand All @@ -181,7 +190,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (Debian / x64)",
Expand All @@ -194,7 +204,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (Fedora 23 / x64)",
Expand All @@ -207,7 +218,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (Fedora 24 / x64)",
Expand All @@ -220,7 +232,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (OpenSUSE 13 / x64)",
Expand All @@ -233,7 +246,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (OpenSUSE 42 / x64)",
Expand All @@ -246,7 +260,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (RHEL / x64)",
Expand All @@ -259,7 +274,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (Ubuntu 14.04 / x64)",
Expand All @@ -272,7 +288,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (Ubuntu 16.04 / x64)",
Expand All @@ -285,7 +302,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
},
{
"description": ".NET Core Debugger (Ubuntu 16.10 / x64)",
Expand All @@ -298,7 +316,8 @@
"binaries": [
"./vsdbg-ui",
"./vsdbg"
]
],
"installTestPath": "./.debugger/vsdbg-ui"
}
],
"engines": {
Expand All @@ -324,6 +343,22 @@
"default": false,
"description": "Suppress the warning that the .NET CLI is not on the path."
},
"csharp.fallbackDebuggerLinuxRuntimeId": {
"type": "string",
"enum": [
"centos.7-x64",
"debian.8-x64",
"fedora.23-x64",
"fedora.24-x64",
"opensuse.13.2-x64",
"opensuse.42.1-x64",
"rhel.7-x64",
"ubuntu.14.04-x64",
"ubuntu.16.04-x64",
"ubuntu.16.10-x64"
],
"description": "If the current Linux distribution is not recognized, this option can be used to tell the debugger what version can be used. After changing this option, close VS Code, remove the debugger folder (~/.vscode/extensions/ms-vscode.csharp-<ver>/.debugger) if it has already downloaded, and restart VS Code."
},
"csharp.suppressDotnetRestoreNotification": {
"type": "boolean",
"default": false,
Expand Down
142 changes: 142 additions & 0 deletions src/CSharpExtDownloader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import TelemetryReporter from 'vscode-extension-telemetry';
import * as util from './common';
import { Logger } from './logger';
import { PackageManager, Status, PackageError } from './packages';
import { PlatformInformation } from './platform';
import { VSCodePlatformInformation } from './vscodePlatform';

/*
* Class used to download the runtime dependencies of the C# Extension
*/
export class CSharpExtDownloader
{
public constructor(
private channel: vscode.OutputChannel,
private logger: Logger,
private reporter: TelemetryReporter /* optional */,
private packageJSON: any) {
}

public installRuntimeDependencies(): Promise<boolean> {
this.logger.append('Updating C# dependencies...');
this.channel.show();

let statusItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
let status: Status = {
setMessage: text => {
statusItem.text = text;
statusItem.show();
},
setDetail: text => {
statusItem.tooltip = text;
statusItem.show();
}
};

// Sends "AcquisitionStart" telemetry to indicate an acquisition started.
if (this.reporter) {
this.reporter.sendTelemetryEvent("AcquisitionStart");
}

let platformInfo: PlatformInformation;
let packageManager: PackageManager;
let installationStage = 'touchBeginFile';
let errorMessage = '';
let success = false;

let telemetryProps: any = {};

return util.touchInstallFile(util.InstallFileType.Begin)
.then(() => {
installationStage = 'getPlatformInfo';
return VSCodePlatformInformation.GetCurrent();
})
.then(info => {
platformInfo = info;
packageManager = new PackageManager(info, this.packageJSON);
this.logger.appendLine();

// Display platform information and RID followed by a blank line
this.logger.appendLine(`Platform: ${info.toString()}`);
this.logger.appendLine();

installationStage = 'downloadPackages';

const config = vscode.workspace.getConfiguration();
const proxy = config.get<string>('http.proxy');
const strictSSL = config.get('http.proxyStrictSSL', true);

return packageManager.DownloadPackages(this.logger, status, proxy, strictSSL);
})
.then(() => {
this.logger.appendLine();

installationStage = 'installPackages';
return packageManager.InstallPackages(this.logger, status);
})
.then(() => {
installationStage = 'touchLockFile';
return util.touchInstallFile(util.InstallFileType.Lock);
})
.then(() => {
installationStage = 'completeSuccess';
success = true;
})
.catch(error => {
if (error instanceof PackageError) {
// we can log the message in a PackageError to telemetry as we do not put PII in PackageError messages
telemetryProps['error.message'] = error.message;

if (error.innerError) {
errorMessage = error.innerError.toString();
} else {
errorMessage = error.message;
}

if (error.pkg) {
telemetryProps['error.packageUrl'] = error.pkg.url;
}

} else {
// do not log raw errorMessage in telemetry as it is likely to contain PII.
errorMessage = error.toString();
}

this.logger.appendLine(`Failed at stage: ${installationStage}`);
this.logger.appendLine(errorMessage);
})
.then(() => {
telemetryProps['installStage'] = installationStage;
telemetryProps['platform.architecture'] = platformInfo.architecture;
telemetryProps['platform.platform'] = platformInfo.platform;
telemetryProps['platform.runtimeId'] = platformInfo.runtimeId;
if (platformInfo.distribution) {
telemetryProps['platform.distribution'] = platformInfo.distribution.toString();
}

if (this.reporter) {
this.reporter.sendTelemetryEvent('Acquisition', telemetryProps);
}

this.logger.appendLine();
installationStage = '';
this.logger.appendLine('Finished');

statusItem.dispose();
})
.then(() => {
// We do this step at the end so that we clean up the begin file in the case that we hit above catch block
// Attach a an empty catch to this so that errors here do not propogate
return util.deleteInstallFile(util.InstallFileType.Begin).catch((error) => { });
}).then(() => {
return success;
});

}
}
Loading

0 comments on commit 610c50d

Please sign in to comment.