@@ -152,19 +152,6 @@ export class JavaDependencyGraph extends DependencyGraph {
152
152
} )
153
153
}
154
154
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
-
168
155
async searchDependency ( uri : vscode . Uri ) : Promise < Set < string > > {
169
156
const filePath = uri . fsPath
170
157
const q : string [ ] = [ ]
@@ -229,26 +216,6 @@ export class JavaDependencyGraph extends DependencyGraph {
229
216
this . _fetchedDirs . add ( dirPath )
230
217
}
231
218
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
-
252
219
private generateBuildFilePaths ( ) {
253
220
const buildFiles : Set < string > = new Set < string > ( )
254
221
this . _buildFileRelativePaths . forEach ( relativePath => {
@@ -372,17 +339,13 @@ export class JavaDependencyGraph extends DependencyGraph {
372
339
await sleep ( 1000 )
373
340
this . autoDetectClasspath ( projectPath , projectName , DependencyGraphConstants . javaBuildExt )
374
341
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.` )
381
343
}
344
+ const buildFiles : string [ ] = this . generateBuildFilePaths ( )
382
345
const truncDirPath = this . getTruncDirPath ( uri )
383
- getLogger ( ) . debug ( `Picked source files:` )
346
+ getLogger ( ) . debug ( `Picked source files: [ ${ [ ... this . _pickedSourceFiles ] . join ( ', ' ) } ] ` )
384
347
this . copyFilesToTmpDir ( this . _pickedSourceFiles , truncDirPath )
385
- getLogger ( ) . debug ( `Picked build artifacts:` )
348
+ getLogger ( ) . debug ( `Picked build artifacts: [ ${ buildFiles } ] ` )
386
349
this . copyFilesToTmpDir ( buildFiles , truncDirPath )
387
350
const totalBuildSize = this . getFilesTotalSize ( Array . from ( buildFiles . values ( ) ) )
388
351
const zipFilePath = this . zipDir ( truncDirPath , CodeWhispererConstants . codeScanZipExt )
0 commit comments