Skip to content

Commit f6f9d64

Browse files
committed
Fix offline package creation
1 parent 981cf65 commit f6f9d64

File tree

1 file changed

+30
-52
lines changed

1 file changed

+30
-52
lines changed

gulpfile.js

Lines changed: 30 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -26,70 +26,49 @@ const PackageManager = packages.PackageManager;
2626
const LinuxDistribution = platform.LinuxDistribution;
2727
const PlatformInformation = platform.PlatformInformation;
2828

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

35-
gulp.task('clean', ['omnisharp:clean', 'debugger:clean', 'package:clean'], () => {
36-
del.sync('install.*');
39+
gulp.task('clean', () => {
40+
cleanSync(true);
3741
});
3842

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

4450
return packageManager.DownloadPackages(logger)
4551
.then(() => {
4652
return packageManager.InstallPackages(logger);
53+
})
54+
.then(() => {
55+
return util.touchInstallFile(util.InstallFileType.Lock)
56+
})
57+
.then(() => {
58+
return debugInstaller.finishInstall();
4759
});
4860
}
4961

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

58-
gulp.task('omnisharp:install', ['omnisharp:clean'], () => {
5965
return PlatformInformation.GetCurrent()
6066
.then(platformInfo => {
61-
return installOmnisharp(platformInfo, getPackageJSON());
67+
return install(platformInfo, getPackageJSON());
6268
});
6369
});
6470

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-
del.sync('.debugger');
76-
}
77-
78-
gulp.task('debugger:install', ['debugger:clean'], () => {
79-
installDebugger(gulp.env.runtimeId)
80-
.then(() => {
81-
console.log('Installed Succesfully');
82-
})
83-
.catch((error) => {
84-
console.error(error);
85-
});
86-
});
87-
88-
gulp.task('debugger:clean', () => {
89-
cleanDebugger();
90-
});
91-
92-
/// Packaging Tasks
71+
/// Packaging (VSIX) Tasks
9372
function doPackageSync(packageName) {
9473

9574
var vsceArgs = [];
@@ -108,13 +87,12 @@ function doPackageSync(packageName) {
10887
}
10988

11089
function doOfflinePackage(platformInfo, packageName, packageJSON) {
111-
return clean()
112-
.then(() => {
113-
return installDebugger(platformInfo.runtimeId);
114-
})
115-
.then(() => {
116-
return installOmnisharp(platformInfo, packageJSON);
117-
})
90+
if (process.platform === 'win32') {
91+
throw new Error('Do not build offline packages on windows. Runtime executables will not be marked executable in *nix packages.');
92+
}
93+
94+
cleanSync(false);
95+
return install(platformInfo, packageJSON)
11896
.then(() => {
11997
doPackageSync(packageName + '-' + platformInfo.runtimeId + '.vsix');
12098
});

0 commit comments

Comments
 (0)