import { ComponentDetails } from 'jfrog-client-js' ; import { NugetDepsTree } from 'nuget-deps-tree' ; import * as path from 'path' ; import Set from 'typescript-collections/dist/lib/Set' ; import * as vscode from 'vscode' ; import { LogManager } from '../log/logManager' ; import { NugetTreeNode } from '../treeDataProviders/dependenciesTree/dependenciesRoot/nugetTree' ; import { DependenciesTreeNode } from '../treeDataProviders/dependenciesTree/dependenciesTreeNode' ; import { TreesManager } from '../treeDataProviders/treesManager' ; export class NugetUtils { public static readonly PKG_TYPE : string = 'nuget' ; param solutions param componentsToScan param treesManager param parent param quickScan public static async createDependenciesTrees ( solutions , componentsToScan , treesManager , parent , quickScan ) { if ( ! solutions ) { treesManager . logManager . logMessage ( 'No *.sln files found in workspaces.' , 'DEBUG' ) ; return ; } treesManager . logManager . logMessage ( 'Solution files to scan: [' + solutions . toString ( ) + ']' , 'DEBUG' ) ; for ( let solution of solutions ) { let tree = await NugetUtils . getProjects ( solution . fsPath , treesManager . logManager , quickScan ) ; if ( ! tree ) { continue ; } let solutionDir = path . dirname ( solution . fsPath ) ; for ( let project of tree . projects ) { let dependenciesTreeNode = new NugetTreeNode ( solutionDir , componentsToScan , treesManager , parent ) ; dependenciesTreeNode . refreshDependencies ( quickScan , project ) ; } } } param slnFilePath param logManager param quickScan private static async getProjects ( slnFilePath , logManager , quickScan ) { let nugetList ; try { nugetList = NugetDepsTree . generate ( slnFilePath ) ; } catch ( error ) { logManager . logError ( < any > error , ! quickScan ) ; logManager . logMessage ( 'Failed building tree for solution "' + slnFilePath + '", due to the above error. Skipping to next solution... ' , 'INFO' ) ; return null ; } if ( ! nugetList . projects ) { logManager . logError ( new Error ( 'No projects found for solution "' + slnFilePath + '".' ) , ! quickScan ) ; logManager . logMessage ( 'Possible cause: The solution needs to be restored. Restore it by running "nuget restore ' + slnFilePath + '".' , 'INFO' ) ; return null ; } return nugetList ; } }