@@ -51,6 +51,7 @@ export interface ZipProjectOptions {
5151 includeGitDiff ?: boolean
5252 metadataDir ?: string
5353 includeNonWorkspaceFiles ?: boolean
54+ silent ?: boolean
5455}
5556
5657export const ZipConstants = {
@@ -210,10 +211,11 @@ export class ZipUtil {
210211 if ( languageCount . size === 0 ) {
211212 throw new NoSourceFilesError ( )
212213 }
214+ const zipDirPath = this . getZipDirPath ( )
213215 this . _language = [ ...languageCount . entries ( ) ] . reduce ( ( a , b ) => ( b [ 1 ] > a [ 1 ] ? b : a ) ) [ 0 ]
214- const zipFilePath = this . getZipDirPath ( ) + CodeWhispererConstants . codeScanZipExt
216+ const zipFilePath = zipDirPath + CodeWhispererConstants . codeScanZipExt
215217 await zip . finalizeToFile ( zipFilePath )
216- return zipFilePath
218+ return this . getGenerateZipResult ( zipDirPath , zipFilePath )
217219 }
218220
219221 protected async processCombinedGitDiff ( zip : ZipStream , projectPaths : string [ ] , filePath ?: string ) {
@@ -343,10 +345,7 @@ export class ZipUtil {
343345 const zipDirPath = this . getZipDirPath ( )
344346 const zipFilePath = await this . zipFile ( uri , options ?. includeGitDiff )
345347
346- if ( ! options ?. silent ) {
347- getLogger ( ) . debug ( `Picked source files: [${ [ ...this . _pickedSourceFiles ] . join ( ', ' ) } ]` )
348- }
349- return this . getGenerateZipResult ( zipDirPath , zipFilePath )
348+ return this . getGenerateZipResult ( zipDirPath , zipFilePath , options ?. silent )
350349 } catch ( error ) {
351350 getLogger ( ) . error ( 'Zip error caused by: %O' , error )
352351 throw error
@@ -355,19 +354,14 @@ export class ZipUtil {
355354
356355 public async generateZipCodeScanForProject ( options ?: GenerateZipOptions ) : Promise < ZipMetadata > {
357356 try {
358- const zipDirPath = this . getZipDirPath ( )
359357 // We assume there is at least one workspace open.
360358 const workspaceFolders = [ ...( vscode . workspace . workspaceFolders ?? [ ] ) ] as CurrentWsFolders
361359
362- const zipFilePath = await this . zipProject ( workspaceFolders , defaultExcludePatterns , {
360+ return await this . zipProject ( workspaceFolders , defaultExcludePatterns , {
363361 includeGitDiff : options ?. includeGitDiff ,
364362 includeNonWorkspaceFiles : true ,
363+ silent : options ?. silent ,
365364 } )
366-
367- if ( ! options ?. silent ) {
368- getLogger ( ) . debug ( `Picked source files: [${ [ ...this . _pickedSourceFiles ] . join ( ', ' ) } ]` )
369- }
370- return this . getGenerateZipResult ( zipDirPath , zipFilePath )
371365 } catch ( error ) {
372366 getLogger ( ) . error ( 'Zip error caused by: %O' , error )
373367 throw error
@@ -402,16 +396,15 @@ export class ZipUtil {
402396 const workspaceFolders = [ ...( vscode . workspace . workspaceFolders ?? [ ] ) ] . sort (
403397 ( a , b ) => b . uri . fsPath . length - a . uri . fsPath . length
404398 ) as CurrentWsFolders
405- const zipFilePath : string = await this . zipProject (
399+ return await this . zipProject (
406400 workspaceFolders ,
407401 [ ...CodeWhispererConstants . testGenExcludePatterns , ...defaultExcludePatterns ] ,
408402 {
409403 metadataDir,
410404 projectPath,
405+ silent : true ,
411406 }
412407 )
413-
414- return this . getGenerateZipResult ( zipDirPath , zipFilePath )
415408 } catch ( error ) {
416409 getLogger ( ) . error ( 'Zip error caused by: %s' , error )
417410 throw new ProjectZipError (
@@ -420,7 +413,14 @@ export class ZipUtil {
420413 }
421414 }
422415
423- protected async getGenerateZipResult ( zipDirpath : string , zipFilePath : string ) : Promise < ZipMetadata > {
416+ protected async getGenerateZipResult (
417+ zipDirpath : string ,
418+ zipFilePath : string ,
419+ silent ?: boolean
420+ ) : Promise < ZipMetadata > {
421+ if ( ! silent ) {
422+ getLogger ( ) . debug ( `Picked source files: [${ [ ...this . _pickedSourceFiles ] . join ( ', ' ) } ]` )
423+ }
424424 return {
425425 rootDir : zipDirpath ,
426426 zipFilePath : zipFilePath ,
0 commit comments