diff --git a/tasks/commandLineArguments.ts b/tasks/commandLineArguments.ts index 41da95d5cc..b74d241d0f 100644 --- a/tasks/commandLineArguments.ts +++ b/tasks/commandLineArguments.ts @@ -8,10 +8,13 @@ import * as minimist from 'minimist'; import * as path from 'path'; -let argv = minimist(process.argv.slice(2)); +let argv = minimist(process.argv.slice(2), { + boolean: ['retainVsix'] +}); -export const commandLineOptions ={ - outputFolder: makePathAbsolute(argv['o']), +export const commandLineOptions = { + retainVsix: !!argv['retainVsix'], + outputFolder: makePathAbsolute(argv['o']), codeExtensionPath: makePathAbsolute(argv['codeExtensionPath']) }; diff --git a/tasks/offlinePackagingTasks.ts b/tasks/offlinePackagingTasks.ts index 725fb69b74..8426d014e7 100644 --- a/tasks/offlinePackagingTasks.ts +++ b/tasks/offlinePackagingTasks.ts @@ -22,6 +22,7 @@ import { PlatformInformation } from '../src/platform'; import { DownloadAndInstallPackages } from '../src/packageManager/PackageManager'; import NetworkSettings from '../src/NetworkSettings'; import { GetRunTimeDependenciesPackages } from '../src/CSharpExtDownloader'; +import { commandLineOptions } from '../tasks/commandLineArguments'; gulp.task('vsix:offline:package', async () => { del.sync(vscodeignorePath); @@ -37,7 +38,14 @@ gulp.task('vsix:offline:package', async () => { }); async function doPackageOffline() { - cleanSync(true); + if (commandLineOptions.retainVsix) { + //if user doesnot want to clean up the existing vsix packages + cleanSync(false); + } + else { + cleanSync(true); + } + util.setExtensionPath(codeExtensionPath); const packageJSON = getPackageJSON(); const name = packageJSON.name; diff --git a/test/releaseTests/offlinePackage.test.ts b/test/releaseTests/offlinePackage.test.ts index 64f99faa3f..49d9ba073b 100644 --- a/test/releaseTests/offlinePackage.test.ts +++ b/test/releaseTests/offlinePackage.test.ts @@ -21,6 +21,7 @@ suite("Offline packaging of VSIX", function () { 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);