@@ -152,19 +152,6 @@ export class JavaDependencyGraph extends DependencyGraph {
152152 } )
153153 }
154154
155- private async getFileLevelBuildFilePaths ( uri : vscode . Uri , projectPath : string ) {
156- const filePath = uri . fsPath
157- this . _pickedSourceFiles . clear ( )
158- this . _pickedSourceFiles . add ( filePath )
159- this . _totalSize = statSync ( filePath ) . size
160- const content = await readFileAsString ( uri . fsPath )
161- this . _totalLines = content . split ( DependencyGraphConstants . newlineRegex ) . length
162- const javaStatement = this . extractStatement ( content )
163- this . _buildFileRelativePaths . clear ( )
164- const buildFileRelativePath = this . generateBuildFileRelativePath ( uri , projectPath , javaStatement . packages )
165- return this . generateOneBuildFilePaths ( buildFileRelativePath )
166- }
167-
168155 async searchDependency ( uri : vscode . Uri ) : Promise < Set < string > > {
169156 const filePath = uri . fsPath
170157 const q : string [ ] = [ ]
@@ -229,26 +216,6 @@ export class JavaDependencyGraph extends DependencyGraph {
229216 this . _fetchedDirs . add ( dirPath )
230217 }
231218
232- private generateOneBuildFilePaths ( buildFileRelativePath : string ) {
233- const oneBuildFilePaths : string [ ] = [ ]
234- this . _outputDirs . forEach ( dir => {
235- const builFilePath = path . join ( dir , buildFileRelativePath )
236- if ( existsSync ( builFilePath ) && oneBuildFilePaths . length === 0 ) {
237- oneBuildFilePaths . push ( builFilePath )
238- }
239- } )
240- this . _outputNonStrictDirs . forEach ( dir => {
241- const builFilePath = path . join ( dir , buildFileRelativePath )
242- if ( existsSync ( builFilePath ) && oneBuildFilePaths . length === 0 ) {
243- oneBuildFilePaths . push ( builFilePath )
244- }
245- } )
246- if ( oneBuildFilePaths . length === 0 ) {
247- throw new Error ( `${ buildFileRelativePath } is not found.` )
248- }
249- return oneBuildFilePaths
250- }
251-
252219 private generateBuildFilePaths ( ) {
253220 const buildFiles : Set < string > = new Set < string > ( )
254221 this . _buildFileRelativePaths . forEach ( relativePath => {
@@ -372,17 +339,13 @@ export class JavaDependencyGraph extends DependencyGraph {
372339 await sleep ( 1000 )
373340 this . autoDetectClasspath ( projectPath , projectName , DependencyGraphConstants . javaBuildExt )
374341 if ( this . _outputDirs . size === 0 && this . _outputNonStrictDirs . size === 0 ) {
375- throw new Error ( `Classpath auto-detection failed.` )
376- }
377- let buildFiles : string [ ] = this . generateBuildFilePaths ( )
378- if ( buildFiles . length === 0 ) {
379- getLogger ( ) . debug ( 'Project level compile error:' )
380- buildFiles = await this . getFileLevelBuildFilePaths ( uri , projectPath )
342+ getLogger ( ) . debug ( `Classpath auto-detection failed.` )
381343 }
344+ const buildFiles : string [ ] = this . generateBuildFilePaths ( )
382345 const truncDirPath = this . getTruncDirPath ( uri )
383- getLogger ( ) . debug ( `Picked source files:` )
346+ getLogger ( ) . debug ( `Picked source files: [ ${ [ ... this . _pickedSourceFiles ] . join ( ', ' ) } ] ` )
384347 this . copyFilesToTmpDir ( this . _pickedSourceFiles , truncDirPath )
385- getLogger ( ) . debug ( `Picked build artifacts:` )
348+ getLogger ( ) . debug ( `Picked build artifacts: [ ${ buildFiles } ] ` )
386349 this . copyFilesToTmpDir ( buildFiles , truncDirPath )
387350 const totalBuildSize = this . getFilesTotalSize ( Array . from ( buildFiles . values ( ) ) )
388351 const zipFilePath = this . zipDir ( truncDirPath , CodeWhispererConstants . codeScanZipExt )
0 commit comments