Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement debugger acquisition to use Package Manager #873

Merged
merged 4 commits into from
Nov 7, 2016
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ bin
node_modules
out
.omnisharp-*/
.debugger

install.lock
install.*

*.vsix
7 changes: 0 additions & 7 deletions coreclr-debug/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions coreclr-debug/NuGet.config

This file was deleted.

13 changes: 0 additions & 13 deletions coreclr-debug/dummy.cs

This file was deleted.

90 changes: 31 additions & 59 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const tslint = require('gulp-tslint');
const vsce = require('vsce');
const debugUtil = require('./out/src/coreclr-debug/util');
const debugInstall = require('./out/src/coreclr-debug/install');
const fs_extra = require('fs-extra-promise');
const packages = require('./out/src/packages');
const logger = require('./out/src/logger');
const platform = require('./out/src/platform');
Expand All @@ -26,75 +25,49 @@ const PackageManager = packages.PackageManager;
const LinuxDistribution = platform.LinuxDistribution;
const PlatformInformation = platform.PlatformInformation;

/// used in offline packaging run so does not clean .vsix
function clean() {
cleanDebugger();
return cleanOmnisharp();
}
function cleanSync(deleteVsix) {
del.sync('install.*');
del.sync('.omnisharp-*');
del.sync('.debugger');

gulp.task('clean', ['omnisharp:clean', 'debugger:clean', 'package:clean'], () => {
if (deleteVsix) {
del.sync('*.vsix');
}
}

gulp.task('clean', () => {
cleanSync(true);
});

/// Omnisharp Tasks
function installOmnisharp(platformInfo, packageJSON) {
// Install Tasks
function install(platformInfo, packageJSON) {
const packageManager = new PackageManager(platformInfo, packageJSON);
const logger = new Logger(message => process.stdout.write(message));
const debuggerUtil = new debugUtil.CoreClrDebugUtil(path.resolve('.'), logger);
const debugInstaller = new debugInstall.DebugInstaller(debuggerUtil);

return packageManager.DownloadPackages(logger)
.then(() => {
return packageManager.InstallPackages(logger);
})
.then(() => {
return util.touchInstallFile(util.InstallFileType.Lock)
})
.then(() => {
return debugInstaller.finishInstall();
});
}

function cleanOmnisharp() {
return del('.omnisharp-*');
}

gulp.task('omnisharp:clean', () => {
return cleanOmnisharp();
});
gulp.task('install', ['clean'], () => {
util.setExtensionPath(__dirname);

gulp.task('omnisharp:install', ['omnisharp:clean'], () => {
return PlatformInformation.GetCurrent()
.then(platformInfo => {
return installOmnisharp(platformInfo, getPackageJSON());
return install(platformInfo, getPackageJSON());
});
});

/// Debugger Tasks
function getDebugInstaller() {
return new debugInstall.DebugInstaller(new debugUtil.CoreClrDebugUtil(path.resolve('.')), true);
}

function installDebugger(runtimeId) {
return getDebugInstaller().install(runtimeId);
}

function cleanDebugger() {
try {
getDebugInstaller().clean();
console.log('Cleaned Succesfully');
} catch (error) {
console.error(error);
}
}

gulp.task('debugger:install', ['debugger:clean'], () => {
installDebugger(gulp.env.runtimeId)
.then(() => {
console.log('Installed Succesfully');
})
.catch((error) => {
console.error(error);
});
});

gulp.task('debugger:clean', () => {
cleanDebugger();
});

/// Packaging Tasks
/// Packaging (VSIX) Tasks
function doPackageSync(packageName) {

var vsceArgs = [];
Expand All @@ -113,13 +86,12 @@ function doPackageSync(packageName) {
}

function doOfflinePackage(platformInfo, packageName, packageJSON) {
return clean()
.then(() => {
return installDebugger(platformInfo.runtimeId);
})
.then(() => {
return installOmnisharp(platformInfo, packageJSON);
})
if (process.platform === 'win32') {
throw new Error('Do not build offline packages on windows. Runtime executables will not be marked executable in *nix packages.');
}

cleanSync(false);
return install(platformInfo, packageJSON)
.then(() => {
doPackageSync(packageName + '-' + platformInfo.runtimeId + '.vsix');
});
Expand All @@ -130,7 +102,7 @@ function getPackageJSON() {
}

gulp.task('package:clean', () => {
return del('*.vsix');
del.sync('*.vsix');
});

gulp.task('package:online', ['clean'], () => {
Expand Down
106 changes: 105 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
]
},
{
"description": "OmniSharp (.NET Core - OSX / x64)",
"description": "OmniSharp (.NET Core - macOS / x64)",
Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-osx-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
Expand Down Expand Up @@ -190,6 +190,110 @@
"darwin",
"linux"
]
},
{
"description": ".NET Core Debugger (Windows / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-win7-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"win7-x64"
]
},
{
"description": ".NET Core Debugger (macOS / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-osx.10.11-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"osx.10.11-x64"
],
"binaries": [
"./OpenDebugAD7",
"./clrdbg"
]
},
{
"description": ".NET Core Debugger (CentOS / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-centos.7-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"centos.7-x64"
],
"binaries": [
"./OpenDebugAD7",
"./clrdbg"
]
},
{
"description": ".NET Core Debugger (Debian / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-debian.8-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"debian.8-x64"
],
"binaries": [
"./OpenDebugAD7",
"./clrdbg"
]
},
{
"description": ".NET Core Debugger (Fedora / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-fedora.23-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"fedora.23-x64"
],
"binaries": [
"./OpenDebugAD7",
"./clrdbg"
]
},
{
"description": ".NET Core Debugger (OpenSUSE / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-opensuse.13.2-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"opensuse.13.2-x64"
],
"binaries": [
"./OpenDebugAD7",
"./clrdbg"
]
},
{
"description": ".NET Core Debugger (RHEL / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-rhel.7.2-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"rhel.7-x64"
],
"binaries": [
"./OpenDebugAD7",
"./clrdbg"
]
},
{
"description": ".NET Core Debugger (Ubuntu 14 / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-ubuntu.14.04-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"ubuntu.14.04-x64"
],
"binaries": [
"./OpenDebugAD7",
"./clrdbg"
]
},
{
"description": ".NET Core Debugger (Ubuntu 16 / x64)",
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-ubuntu.16.04-x64.zip",
"installPath": ".debugger",
"runtimeIds": [
"ubuntu.16.04-x64"
],
"binaries": [
"./OpenDebugAD7",
"./clrdbg"
]
}
],
"engines": {
Expand Down
34 changes: 27 additions & 7 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,39 @@ export function fileExists(filePath: string): Promise<boolean> {
});
}

function getInstallLockFilePath(): string {
return path.resolve(getExtensionPath(), 'install.lock');
export enum InstallFileType {
Begin,
Lock
}

export function lockFileExists(): Promise<boolean> {
return fileExists(getInstallLockFilePath());
function getInstallFilePath(type: InstallFileType): string {
let installFile = 'install.' + InstallFileType[type];
return path.resolve(getExtensionPath(), installFile);
}

export function touchLockFile(): Promise<void> {
export function installFileExists(type: InstallFileType): Promise<boolean> {
return fileExists(getInstallFilePath(type));
}

export function touchInstallFile(type: InstallFileType): Promise<void> {
return new Promise<void>((resolve, reject) => {
fs.writeFile(getInstallFilePath(type), '', err => {
if (err) {
reject(err);
Copy link
Member

@DustinCampbell DustinCampbell Nov 4, 2016

Choose a reason for hiding this comment

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

I'd return here so that it doesn't carry on to the resolve below. #Pending

return;
}

resolve();
});
});
}

export function deleteInstallFile(type: InstallFileType): Promise<void> {
return new Promise<void>((resolve, reject) => {
fs.writeFile(getInstallLockFilePath(), '', err => {
fs.unlink(getInstallFilePath(type), err => {
if (err) {
return reject(err);
reject(err);
return;
}

resolve();
Expand Down
Loading