forked from microsoft/vscode-mssql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackagetasks.js
82 lines (72 loc) · 2.68 KB
/
packagetasks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var gulp = require('gulp');
var fs = require('fs');
var cproc = require('child_process');
var del = require('del');
function installSqlToolsService(platform) {
var install = require('../out/src/languageservice/serviceInstallerUtil');
return install.installService(platform);
}
gulp.task('ext:install-service', () => {
return installSqlToolsService();
});
function doPackageSync(packageName) {
var vsceArgs = [];
vsceArgs.push('vsce');
vsceArgs.push('package'); // package command
if (packageName !== undefined) {
vsceArgs.push('-o');
vsceArgs.push(packageName);
}
var command = vsceArgs.join(' ');
console.log(command);
return cproc.execSync(command);
}
function cleanServiceInstallFolder() {
var install = require('../out/src/languageservice/serviceInstallerUtil');
var serviceInstallFolder = install.getServiceInstallDirectoryRoot();
console.log('Deleting Service Install folder: ' + serviceInstallFolder);
return del(serviceInstallFolder + '/*');
}
function doOfflinePackage(runtimeId, platform, packageName) {
return installSqlToolsService(platform).then(() => {
return doPackageSync(packageName + '-' + runtimeId + '.vsix');
});
}
//Install vsce to be able to run this task: npm install -g vsce
gulp.task('package:online', () => {
return cleanServiceInstallFolder().then(() => {
doPackageSync();
return installSqlToolsService();
});
});
//Install vsce to be able to run this task: npm install -g vsce
gulp.task('package:offline', () => {
const platform = require('../out/src/models/platform');
const Runtime = platform.Runtime;
var json = JSON.parse(fs.readFileSync('package.json'));
var name = json.name;
var version = json.version;
var packageName = name + '-' + version;
var packages = [];
packages.push({ rid: 'win-x64', runtime: Runtime.Windows_64 });
packages.push({ rid: 'win-x86', runtime: Runtime.Windows_86 });
packages.push({ rid: 'osx.10.11-x64', runtime: Runtime.OSX_10_11_64 });
packages.push({ rid: 'centos.7-x64', runtime: Runtime.CentOS_7 });
packages.push({ rid: 'debian.8-x64', runtime: Runtime.Debian_8 });
packages.push({ rid: 'fedora.23-x64', runtime: Runtime.Fedora_23 });
packages.push({ rid: 'opensuse.13.2-x64', runtime: Runtime.OpenSUSE_13_2 });
packages.push({ rid: 'rhel.7.2-x64', runtime: Runtime.RHEL_7 });
packages.push({ rid: 'ubuntu.14.04-x64', runtime: Runtime.Ubuntu_14 });
packages.push({ rid: 'ubuntu.16.04-x64', runtime: Runtime.Ubuntu_16 });
var promise = Promise.resolve();
cleanServiceInstallFolder().then(() => {
packages.forEach(data => {
promise = promise.then(() => {
return doOfflinePackage(data.rid, data.runtime, packageName).then(() => {
return cleanServiceInstallFolder();
});
});
});
});
return promise;
});