Remove the retain vsix option and check for absolute path (#2222)
* Clean up tasks * Use tmp asset
This commit is contained in:
Родитель
5a7727be25
Коммит
5691f27ba7
|
@ -8,12 +8,9 @@
|
|||
import * as minimist from 'minimist';
|
||||
import * as path from 'path';
|
||||
|
||||
let argv = minimist(process.argv.slice(2), {
|
||||
boolean: ['retainVsix']
|
||||
});
|
||||
let argv = minimist(process.argv.slice(2));
|
||||
|
||||
export const commandLineOptions ={
|
||||
retainVsix: !!argv['retainVsix'],
|
||||
outputFolder: makePathAbsolute(argv['o']),
|
||||
codeExtensionPath: makePathAbsolute(argv['codeExtensionPath'])
|
||||
};
|
||||
|
@ -23,9 +20,5 @@ function makePathAbsolute(originalPath: string) {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
if (path.isAbsolute(originalPath)) {
|
||||
return originalPath;
|
||||
}
|
||||
|
||||
return path.resolve(originalPath);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import * as path from 'path';
|
|||
import * as util from '../src/common';
|
||||
import spawnNode from '../tasks/spawnNode';
|
||||
import { codeExtensionPath, offlineVscodeignorePath, vscodeignorePath, vscePath, packedVsixOutputRoot } from '../tasks/projectPaths';
|
||||
import { commandLineOptions } from '../tasks/commandLineArguments';
|
||||
import { CsharpLoggerObserver } from '../src/observers/CsharpLoggerObserver';
|
||||
import { EventStream } from '../src/EventStream';
|
||||
import { getPackageJSON } from '../tasks/packageJson';
|
||||
|
@ -38,16 +37,8 @@ gulp.task('vsix:offline:package', async () => {
|
|||
});
|
||||
|
||||
async function doPackageOffline() {
|
||||
cleanSync(true);
|
||||
util.setExtensionPath(codeExtensionPath);
|
||||
|
||||
if (commandLineOptions.retainVsix) {
|
||||
//if user doesnot want to clean up the existing vsix packages
|
||||
cleanSync(false);
|
||||
}
|
||||
else {
|
||||
cleanSync(true);
|
||||
}
|
||||
|
||||
const packageJSON = getPackageJSON();
|
||||
const name = packageJSON.name;
|
||||
const version = packageJSON.version;
|
||||
|
@ -80,9 +71,7 @@ async function doOfflinePackage(platformInfo: PlatformInformation, packageName:
|
|||
}
|
||||
|
||||
cleanSync(false);
|
||||
|
||||
const packageFileName = `${packageName}-${platformInfo.platform}-${platformInfo.architecture}.vsix`;
|
||||
|
||||
await install(platformInfo, packageJSON);
|
||||
await doPackageSync(packageFileName, outputFolder);
|
||||
}
|
||||
|
|
|
@ -8,21 +8,19 @@ import * as glob from 'glob-promise';
|
|||
import * as path from 'path';
|
||||
import { invokeNode } from './testAssets/testAssets';
|
||||
import { PlatformInformation } from '../../src/platform';
|
||||
import { rimraf } from 'async-file';
|
||||
import * as tmp from 'tmp';
|
||||
import { TmpAsset, CreateTmpDir } from '../../src/CreateTmpAsset';
|
||||
|
||||
suite("Offline packaging of VSIX", function () {
|
||||
let vsixFiles: string[];
|
||||
this.timeout(1000000);
|
||||
let tmpDir: tmp.SynchrounousResult = null;
|
||||
let tmpDir: TmpAsset;
|
||||
|
||||
suiteSetup(() => {
|
||||
suiteSetup(async () => {
|
||||
chai.should();
|
||||
tmpDir = tmp.dirSync();
|
||||
tmpDir = await CreateTmpDir(true);
|
||||
let args: string[] = [];
|
||||
args.push(path.join("node_modules", "gulp", "bin", "gulp.js"));
|
||||
args.push("package:offline");
|
||||
args.push("--retainVsix");// do not delete the existing vsix in the repo
|
||||
args.push(`-o`);
|
||||
args.push(tmpDir.name);
|
||||
invokeNode(args);
|
||||
|
@ -46,9 +44,7 @@ suite("Offline packaging of VSIX", function () {
|
|||
|
||||
suiteTeardown(async () => {
|
||||
if (tmpDir) {
|
||||
await rimraf(tmpDir.name);
|
||||
tmpDir.dispose();
|
||||
}
|
||||
|
||||
tmpDir = null;
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче