2016-09-19 20:27:33 +03:00
|
|
|
|
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
|
2016-09-20 03:59:22 +03:00
|
|
|
|
gulp.task('package:online', () => {
|
2016-09-19 20:27:33 +03:00
|
|
|
|
return cleanServiceInstallFolder().then(() => {
|
|
|
|
|
doPackageSync();
|
2016-09-20 03:59:22 +03:00
|
|
|
|
return installSqlToolsService();
|
2016-09-19 20:27:33 +03:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//Install vsce to be able to run this task: npm install -g vsce
|
|
|
|
|
gulp.task('package:offline', () => {
|
|
|
|
|
const platform = require('../out/src/models/platform');
|
2016-11-23 04:04:18 +03:00
|
|
|
|
const Runtime = platform.Runtime;
|
2016-09-19 20:27:33 +03:00
|
|
|
|
var json = JSON.parse(fs.readFileSync('package.json'));
|
|
|
|
|
var name = json.name;
|
|
|
|
|
var version = json.version;
|
2016-09-20 03:59:22 +03:00
|
|
|
|
var packageName = name + '-' + version;
|
2016-09-19 20:27:33 +03:00
|
|
|
|
|
|
|
|
|
var packages = [];
|
2016-11-23 04:04:18 +03:00
|
|
|
|
packages.push({rid: 'win7-x64', runtime: Runtime.Windows_7_64});
|
2017-01-20 00:54:35 +03:00
|
|
|
|
packages.push({rid: 'win7-x86', runtime: Runtime.Windows_7_86});
|
2016-11-23 04:04:18 +03:00
|
|
|
|
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});
|
2016-09-19 20:27:33 +03:00
|
|
|
|
var promise = Promise.resolve();
|
|
|
|
|
cleanServiceInstallFolder().then(() => {
|
|
|
|
|
packages.forEach(data => {
|
|
|
|
|
promise = promise.then(() => {
|
2016-11-23 04:04:18 +03:00
|
|
|
|
return doOfflinePackage(data.rid, data.runtime, packageName).then(() => {
|
2016-09-19 20:27:33 +03:00
|
|
|
|
return cleanServiceInstallFolder();
|
|
|
|
|
});
|
|
|
|
|
});
|
2016-11-23 04:04:18 +03:00
|
|
|
|
});
|
2016-09-19 20:27:33 +03:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return promise;
|
|
|
|
|
});
|