@@ -150,43 +150,19 @@ async function getDependencyIssues(dependencies: PackageDescription[]): Promise<
150150 return issues ;
151151}
152152
153- async function getProjectIssues ( projectNode : INodeData ) : Promise < UpgradeIssue [ ] > {
153+ async function getWorkspaceIssues ( projectDeps :{ projectNode : INodeData , dependencies : PackageDescription [ ] } [ ] ) : Promise < UpgradeIssue [ ] > {
154+
154155 const issues : UpgradeIssue [ ] = [ ] ;
155- const dependencies = await getDirectDependencies ( projectNode ) ;
156- if ( dependencies . length === 0 ) {
157- sendInfo ( "" , {
158- operationName : "java.dependency.assessmentManager.getProjectIssues.noDirectDependencies"
159- } ) ;
160- return issues ;
156+ const dependenciesSet : Set < PackageDescription > = new Set ( ) ;
157+ for ( const { projectNode, dependencies } of projectDeps ) {
158+ issues . push ( ...getJavaIssues ( projectNode ) ) ;
159+ dependencies . forEach ( dep => dependenciesSet . add ( dep ) ) ;
161160 }
162- issues . push ( ...await getCVEIssues ( dependencies ) ) ;
163- issues . push ( ...getJavaIssues ( projectNode ) ) ;
164- issues . push ( ...await getDependencyIssues ( dependencies ) ) ;
165-
161+ issues . push ( ...await getCVEIssues ( Array . from ( dependenciesSet ) ) ) ;
162+ issues . push ( ...await getDependencyIssues ( Array . from ( dependenciesSet ) ) ) ;
166163 return issues ;
167164}
168165
169- async function getWorkspaceIssues ( workspaceFolderUri : string ) : Promise < UpgradeIssue [ ] > {
170- const projects = await Jdtls . getProjects ( workspaceFolderUri ) ;
171- const projectsIssues = await Promise . allSettled ( projects . map ( async ( projectNode ) => {
172- const issues = await getProjectIssues ( projectNode ) ;
173- return issues ;
174- } ) ) ;
175-
176- const workspaceIssues = projectsIssues . map ( x => {
177- if ( x . status === "fulfilled" ) {
178- return x . value ;
179- }
180-
181- sendInfo ( "" , {
182- operationName : "java.dependency.assessmentManager.getWorkspaceIssues" ,
183- } ) ;
184- return [ ] ;
185- } ) . flat ( ) ;
186-
187- return workspaceIssues ;
188- }
189-
190166/**
191167 * Find all pom.xml files in a directory using glob
192168 */
@@ -328,7 +304,7 @@ async function parseDirectDependenciesFromGradle(projectPath: string): Promise<S
328304 return directDeps ;
329305}
330306
331- async function getDirectDependencies ( projectNode : INodeData ) : Promise < PackageDescription [ ] > {
307+ export async function getDirectDependencies ( projectNode : INodeData ) : Promise < PackageDescription [ ] > {
332308 const projectStructureData = await Jdtls . getPackageData ( { kind : NodeKind . Project , projectUri : projectNode . uri } ) ;
333309 // Only include Maven or Gradle containers (not JRE or other containers)
334310 const dependencyContainers = projectStructureData . filter ( x =>
@@ -339,8 +315,6 @@ async function getDirectDependencies(projectNode: INodeData): Promise<PackageDes
339315 if ( dependencyContainers . length === 0 ) {
340316 return [ ] ;
341317 }
342- // Determine build type from dependency containers
343- const isMaven = dependencyContainers . some ( x => x . path ?. startsWith ( ContainerPath . Maven ) ) ;
344318
345319 const allPackages = await Promise . allSettled (
346320 dependencyContainers . map ( async ( packageContainer ) => {
@@ -368,11 +342,13 @@ async function getDirectDependencies(projectNode: INodeData): Promise<PackageDes
368342
369343 if ( ! dependencies ) {
370344 sendInfo ( "" , {
371- operationName : "java.dependency.assessmentManager.getDirectDependencies.noDependencyInfo" ,
372- buildType : isMaven ? "maven" : "gradle" ,
345+ operationName : "java.dependency.assessmentManager.getDirectDependencies.noDependencyInfo"
373346 } ) ;
374347 return [ ] ;
375348 }
349+
350+ // Determine build type from dependency containers
351+ const isMaven = dependencyContainers . some ( x => x . path ?. startsWith ( ContainerPath . Maven ) ) ;
376352 // Get direct dependency identifiers from build files
377353 let directDependencyIds : Set < string > | null = null ;
378354 if ( projectNode . uri && dependencyContainers . length > 0 ) {
@@ -390,10 +366,10 @@ async function getDirectDependencies(projectNode: INodeData): Promise<PackageDes
390366
391367 if ( ! directDependencyIds ) {
392368 sendInfo ( "" , {
393- operationName : "java.dependency.assessmentManager.getDirectDependencies.noDirectDependencyInfo" ,
394- buildType : isMaven ? "maven" : "gradle" ,
369+ operationName : "java.dependency.assessmentManager.getDirectDependencies.noDirectDependencyInfo"
395370 } ) ;
396- return [ ] ;
371+ //TODO: fallback to return all dependencies if we cannot parse direct dependencies or just return empty?
372+ return dependencies ;
397373 }
398374 // Filter to only direct dependencies if we have build file info
399375 if ( directDependencyIds && directDependencyIds . size > 0 ) {
@@ -402,16 +378,7 @@ async function getDirectDependencies(projectNode: INodeData): Promise<PackageDes
402378 ) ;
403379 }
404380
405- // Deduplicate by GAV coordinates
406- const seen = new Set < string > ( ) ;
407- return dependencies . filter ( pkg => {
408- const key = `${ pkg . groupId } :${ pkg . artifactId } :${ pkg . version } ` ;
409- if ( seen . has ( key ) ) {
410- return false ;
411- }
412- seen . add ( key ) ;
413- return true ;
414- } ) ;
381+ return dependencies ;
415382}
416383
417384async function getCVEIssues ( dependencies : PackageDescription [ ] ) : Promise < UpgradeIssue [ ] > {
0 commit comments