Skip to content

Commit e906f18

Browse files
authored
Merge pull request #873 from chuckries/debuggerPackage
Reimplement debugger acquisition to use Package Manager
2 parents a50a463 + 2480214 commit e906f18

File tree

12 files changed

+363
-618
lines changed

12 files changed

+363
-618
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ bin
22
node_modules
33
out
44
.omnisharp-*/
5+
.debugger
56

6-
install.lock
7+
install.*
78

89
*.vsix

coreclr-debug/.gitignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

coreclr-debug/NuGet.config

Lines changed: 0 additions & 10 deletions
This file was deleted.

coreclr-debug/dummy.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

gulpfile.js

Lines changed: 31 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const tslint = require('gulp-tslint');
1414
const vsce = require('vsce');
1515
const debugUtil = require('./out/src/coreclr-debug/util');
1616
const debugInstall = require('./out/src/coreclr-debug/install');
17-
const fs_extra = require('fs-extra-promise');
1817
const packages = require('./out/src/packages');
1918
const logger = require('./out/src/logger');
2019
const platform = require('./out/src/platform');
@@ -26,75 +25,49 @@ const PackageManager = packages.PackageManager;
2625
const LinuxDistribution = platform.LinuxDistribution;
2726
const PlatformInformation = platform.PlatformInformation;
2827

29-
/// used in offline packaging run so does not clean .vsix
30-
function clean() {
31-
cleanDebugger();
32-
return cleanOmnisharp();
33-
}
28+
function cleanSync(deleteVsix) {
29+
del.sync('install.*');
30+
del.sync('.omnisharp-*');
31+
del.sync('.debugger');
3432

35-
gulp.task('clean', ['omnisharp:clean', 'debugger:clean', 'package:clean'], () => {
33+
if (deleteVsix) {
34+
del.sync('*.vsix');
35+
}
36+
}
3637

38+
gulp.task('clean', () => {
39+
cleanSync(true);
3740
});
3841

39-
/// Omnisharp Tasks
40-
function installOmnisharp(platformInfo, packageJSON) {
42+
// Install Tasks
43+
function install(platformInfo, packageJSON) {
4144
const packageManager = new PackageManager(platformInfo, packageJSON);
4245
const logger = new Logger(message => process.stdout.write(message));
46+
const debuggerUtil = new debugUtil.CoreClrDebugUtil(path.resolve('.'), logger);
47+
const debugInstaller = new debugInstall.DebugInstaller(debuggerUtil);
4348

4449
return packageManager.DownloadPackages(logger)
4550
.then(() => {
4651
return packageManager.InstallPackages(logger);
52+
})
53+
.then(() => {
54+
return util.touchInstallFile(util.InstallFileType.Lock)
55+
})
56+
.then(() => {
57+
return debugInstaller.finishInstall();
4758
});
4859
}
4960

50-
function cleanOmnisharp() {
51-
return del('.omnisharp-*');
52-
}
53-
54-
gulp.task('omnisharp:clean', () => {
55-
return cleanOmnisharp();
56-
});
61+
gulp.task('install', ['clean'], () => {
62+
util.setExtensionPath(__dirname);
5763

58-
gulp.task('omnisharp:install', ['omnisharp:clean'], () => {
5964
return PlatformInformation.GetCurrent()
6065
.then(platformInfo => {
61-
return installOmnisharp(platformInfo, getPackageJSON());
66+
return install(platformInfo, getPackageJSON());
6267
});
6368
});
6469

65-
/// Debugger Tasks
66-
function getDebugInstaller() {
67-
return new debugInstall.DebugInstaller(new debugUtil.CoreClrDebugUtil(path.resolve('.')), true);
68-
}
69-
70-
function installDebugger(runtimeId) {
71-
return getDebugInstaller().install(runtimeId);
72-
}
73-
74-
function cleanDebugger() {
75-
try {
76-
getDebugInstaller().clean();
77-
console.log('Cleaned Succesfully');
78-
} catch (error) {
79-
console.error(error);
80-
}
81-
}
82-
83-
gulp.task('debugger:install', ['debugger:clean'], () => {
84-
installDebugger(gulp.env.runtimeId)
85-
.then(() => {
86-
console.log('Installed Succesfully');
87-
})
88-
.catch((error) => {
89-
console.error(error);
90-
});
91-
});
92-
93-
gulp.task('debugger:clean', () => {
94-
cleanDebugger();
95-
});
96-
97-
/// Packaging Tasks
70+
/// Packaging (VSIX) Tasks
9871
function doPackageSync(packageName) {
9972

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

11588
function doOfflinePackage(platformInfo, packageName, packageJSON) {
116-
return clean()
117-
.then(() => {
118-
return installDebugger(platformInfo.runtimeId);
119-
})
120-
.then(() => {
121-
return installOmnisharp(platformInfo, packageJSON);
122-
})
89+
if (process.platform === 'win32') {
90+
throw new Error('Do not build offline packages on windows. Runtime executables will not be marked executable in *nix packages.');
91+
}
92+
93+
cleanSync(false);
94+
return install(platformInfo, packageJSON)
12395
.then(() => {
12496
doPackageSync(packageName + '-' + platformInfo.runtimeId + '.vsix');
12597
});
@@ -130,7 +102,7 @@ function getPackageJSON() {
130102
}
131103

132104
gulp.task('package:clean', () => {
133-
return del('*.vsix');
105+
del.sync('*.vsix');
134106
});
135107

136108
gulp.task('package:online', ['clean'], () => {

package.json

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
]
9292
},
9393
{
94-
"description": "OmniSharp (.NET Core - OSX / x64)",
94+
"description": "OmniSharp (.NET Core - macOS / x64)",
9595
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-osx-x64-netcoreapp1.0.zip",
9696
"installPath": ".omnisharp-coreclr",
9797
"runtimeIds": [
@@ -190,6 +190,110 @@
190190
"darwin",
191191
"linux"
192192
]
193+
},
194+
{
195+
"description": ".NET Core Debugger (Windows / x64)",
196+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-win7-x64.zip",
197+
"installPath": ".debugger",
198+
"runtimeIds": [
199+
"win7-x64"
200+
]
201+
},
202+
{
203+
"description": ".NET Core Debugger (macOS / x64)",
204+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-osx.10.11-x64.zip",
205+
"installPath": ".debugger",
206+
"runtimeIds": [
207+
"osx.10.11-x64"
208+
],
209+
"binaries": [
210+
"./OpenDebugAD7",
211+
"./clrdbg"
212+
]
213+
},
214+
{
215+
"description": ".NET Core Debugger (CentOS / x64)",
216+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-centos.7-x64.zip",
217+
"installPath": ".debugger",
218+
"runtimeIds": [
219+
"centos.7-x64"
220+
],
221+
"binaries": [
222+
"./OpenDebugAD7",
223+
"./clrdbg"
224+
]
225+
},
226+
{
227+
"description": ".NET Core Debugger (Debian / x64)",
228+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-debian.8-x64.zip",
229+
"installPath": ".debugger",
230+
"runtimeIds": [
231+
"debian.8-x64"
232+
],
233+
"binaries": [
234+
"./OpenDebugAD7",
235+
"./clrdbg"
236+
]
237+
},
238+
{
239+
"description": ".NET Core Debugger (Fedora / x64)",
240+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-fedora.23-x64.zip",
241+
"installPath": ".debugger",
242+
"runtimeIds": [
243+
"fedora.23-x64"
244+
],
245+
"binaries": [
246+
"./OpenDebugAD7",
247+
"./clrdbg"
248+
]
249+
},
250+
{
251+
"description": ".NET Core Debugger (OpenSUSE / x64)",
252+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-opensuse.13.2-x64.zip",
253+
"installPath": ".debugger",
254+
"runtimeIds": [
255+
"opensuse.13.2-x64"
256+
],
257+
"binaries": [
258+
"./OpenDebugAD7",
259+
"./clrdbg"
260+
]
261+
},
262+
{
263+
"description": ".NET Core Debugger (RHEL / x64)",
264+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-rhel.7.2-x64.zip",
265+
"installPath": ".debugger",
266+
"runtimeIds": [
267+
"rhel.7-x64"
268+
],
269+
"binaries": [
270+
"./OpenDebugAD7",
271+
"./clrdbg"
272+
]
273+
},
274+
{
275+
"description": ".NET Core Debugger (Ubuntu 14 / x64)",
276+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-ubuntu.14.04-x64.zip",
277+
"installPath": ".debugger",
278+
"runtimeIds": [
279+
"ubuntu.14.04-x64"
280+
],
281+
"binaries": [
282+
"./OpenDebugAD7",
283+
"./clrdbg"
284+
]
285+
},
286+
{
287+
"description": ".NET Core Debugger (Ubuntu 16 / x64)",
288+
"url": "https://vsdebugger.azureedge.net/coreclr-debug-1-5-0/coreclr-debug-ubuntu.16.04-x64.zip",
289+
"installPath": ".debugger",
290+
"runtimeIds": [
291+
"ubuntu.16.04-x64"
292+
],
293+
"binaries": [
294+
"./OpenDebugAD7",
295+
"./clrdbg"
296+
]
193297
}
194298
],
195299
"engines": {

src/common.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,39 @@ export function fileExists(filePath: string): Promise<boolean> {
6060
});
6161
}
6262

63-
function getInstallLockFilePath(): string {
64-
return path.resolve(getExtensionPath(), 'install.lock');
63+
export enum InstallFileType {
64+
Begin,
65+
Lock
6566
}
6667

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

71-
export function touchLockFile(): Promise<void> {
73+
export function installFileExists(type: InstallFileType): Promise<boolean> {
74+
return fileExists(getInstallFilePath(type));
75+
}
76+
77+
export function touchInstallFile(type: InstallFileType): Promise<void> {
78+
return new Promise<void>((resolve, reject) => {
79+
fs.writeFile(getInstallFilePath(type), '', err => {
80+
if (err) {
81+
reject(err);
82+
return;
83+
}
84+
85+
resolve();
86+
});
87+
});
88+
}
89+
90+
export function deleteInstallFile(type: InstallFileType): Promise<void> {
7291
return new Promise<void>((resolve, reject) => {
73-
fs.writeFile(getInstallLockFilePath(), '', err => {
92+
fs.unlink(getInstallFilePath(type), err => {
7493
if (err) {
75-
return reject(err);
94+
reject(err);
95+
return;
7696
}
7797

7898
resolve();

0 commit comments

Comments
 (0)