Skip to content

Commit 5691f27

Browse files
authored
Remove the retain vsix option and check for absolute path (#2222)
* Clean up tasks * Use tmp asset
1 parent 5a7727b commit 5691f27

File tree

3 files changed

+7
-29
lines changed

3 files changed

+7
-29
lines changed

tasks/commandLineArguments.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@
88
import * as minimist from 'minimist';
99
import * as path from 'path';
1010

11-
let argv = minimist(process.argv.slice(2), {
12-
boolean: ['retainVsix']
13-
});
11+
let argv = minimist(process.argv.slice(2));
1412

1513
export const commandLineOptions ={
16-
retainVsix: !!argv['retainVsix'],
1714
outputFolder: makePathAbsolute(argv['o']),
1815
codeExtensionPath: makePathAbsolute(argv['codeExtensionPath'])
1916
};
@@ -23,9 +20,5 @@ function makePathAbsolute(originalPath: string) {
2320
return undefined;
2421
}
2522

26-
if (path.isAbsolute(originalPath)) {
27-
return originalPath;
28-
}
29-
3023
return path.resolve(originalPath);
3124
}

tasks/offlinePackagingTasks.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import * as path from 'path';
1414
import * as util from '../src/common';
1515
import spawnNode from '../tasks/spawnNode';
1616
import { codeExtensionPath, offlineVscodeignorePath, vscodeignorePath, vscePath, packedVsixOutputRoot } from '../tasks/projectPaths';
17-
import { commandLineOptions } from '../tasks/commandLineArguments';
1817
import { CsharpLoggerObserver } from '../src/observers/CsharpLoggerObserver';
1918
import { EventStream } from '../src/EventStream';
2019
import { getPackageJSON } from '../tasks/packageJson';
@@ -38,16 +37,8 @@ gulp.task('vsix:offline:package', async () => {
3837
});
3938

4039
async function doPackageOffline() {
40+
cleanSync(true);
4141
util.setExtensionPath(codeExtensionPath);
42-
43-
if (commandLineOptions.retainVsix) {
44-
//if user doesnot want to clean up the existing vsix packages
45-
cleanSync(false);
46-
}
47-
else {
48-
cleanSync(true);
49-
}
50-
5142
const packageJSON = getPackageJSON();
5243
const name = packageJSON.name;
5344
const version = packageJSON.version;
@@ -80,9 +71,7 @@ async function doOfflinePackage(platformInfo: PlatformInformation, packageName:
8071
}
8172

8273
cleanSync(false);
83-
8474
const packageFileName = `${packageName}-${platformInfo.platform}-${platformInfo.architecture}.vsix`;
85-
8675
await install(platformInfo, packageJSON);
8776
await doPackageSync(packageFileName, outputFolder);
8877
}

test/releaseTests/offlinePackage.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,19 @@ import * as glob from 'glob-promise';
88
import * as path from 'path';
99
import { invokeNode } from './testAssets/testAssets';
1010
import { PlatformInformation } from '../../src/platform';
11-
import { rimraf } from 'async-file';
12-
import * as tmp from 'tmp';
11+
import { TmpAsset, CreateTmpDir } from '../../src/CreateTmpAsset';
1312

1413
suite("Offline packaging of VSIX", function () {
1514
let vsixFiles: string[];
1615
this.timeout(1000000);
17-
let tmpDir: tmp.SynchrounousResult = null;
16+
let tmpDir: TmpAsset;
1817

19-
suiteSetup(() => {
18+
suiteSetup(async () => {
2019
chai.should();
21-
tmpDir = tmp.dirSync();
20+
tmpDir = await CreateTmpDir(true);
2221
let args: string[] = [];
2322
args.push(path.join("node_modules", "gulp", "bin", "gulp.js"));
2423
args.push("package:offline");
25-
args.push("--retainVsix");// do not delete the existing vsix in the repo
2624
args.push(`-o`);
2725
args.push(tmpDir.name);
2826
invokeNode(args);
@@ -46,9 +44,7 @@ suite("Offline packaging of VSIX", function () {
4644

4745
suiteTeardown(async () => {
4846
if (tmpDir) {
49-
await rimraf(tmpDir.name);
47+
tmpDir.dispose();
5048
}
51-
52-
tmpDir = null;
5349
});
5450
});

0 commit comments

Comments
 (0)