@Override
    protected ResolutionResult resolveDependencies(String projectFolder, String topLevelFolder, Set<String> bomFiles) {
        logger.debug("gradleAggregateModules={}",gradleAggregateModules);
        // In order to use the gradle wrapper, we define the top folder that contains the wrapper
        this.gradleCli.setTopLevelFolderGradlew(topLevelFolder);
        // each bom-file ( = build.gradle) represents a module - identify its folder and scan it using 'gradle dependencies'
        Map<AgentProjectInfo, Path> projectInfoPathMap = new HashMap<>();
        Collection<String> excludes = new HashSet<>();

        //        // Get the list of projects as paths
        //        List<String> projectsList = null;
        //        if (bomFiles.size() > 1) {
        //            projectsList = collectProjects(topLevelFolder);
        //        }
        //        if (projectsList == null) {
        //            logger.warn("Command \"gradle projects\" did not return a list of projects");
        //        }
        if (gradleRunPreStep) {
            downloadMissingDependencies(projectFolder);
        }

        for (String bomFile : bomFiles) {
            String bomFileFolder = new File(bomFile).getParent();
            File bomFolder = new File(new File(bomFile).getParent());
            String moduleName = bomFolder.getName();
            //            String moduleRelativeName = Constants.EMPTY_STRING;
            //            try {
            //                String canonicalPath = bomFolder.getCanonicalPath();
            //                // Relative name by replacing the root folder with "." - will look something like .\abc\def
            //                moduleRelativeName = Constants.DOT + canonicalPath.replaceFirst(Pattern.quote(topLevelFolder), Constants.EMPTY_STRING);
            //            } catch (Exception e) {
            //                logger.debug("Error getting path - {} ", e.getMessage());
            //            }
            //            // making sure the module's folder was listed by "gradle projects" command
            //            if (!moduleRelativeName.isEmpty() && projectsList != null && !projectsList.contains(moduleRelativeName)) {
            //                logger.debug("Ignoring project at {} - because it was not listed by \"gradle projects\" command", moduleRelativeName);
            //                continue;
            //            }
            List<String> lines = getDependenciesTree(bomFileFolder, moduleName);
            if (lines != null) {
                List<DependencyInfo> dependencies = collectDependencies(lines, bomFileFolder, bomFileFolder.equals(topLevelFolder), bomFile);
                if (dependencies.size() > 0) {
                    AgentProjectInfo agentProjectInfo = new AgentProjectInfo();
                    agentProjectInfo.getDependencies().addAll(dependencies);
                    if (!gradleAggregateModules) {
                        Coordinates coordinates = new Coordinates();
                        coordinates.setArtifactId(moduleName);
                        agentProjectInfo.setCoordinates(coordinates);
                    }
                    projectInfoPathMap.put(agentProjectInfo, bomFolder.toPath());
                    if (ignoreSourceCode) {
                        excludes.addAll(normalizeLocalPath(projectFolder, topLevelFolder, extensionPattern(GRADLE_SCRIPT_EXTENSION), null));
                    }
                }
            }
        }
        topLevelFoldersNames.add(topLevelFolder.substring(topLevelFolder.lastIndexOf(fileSeparator) + 1));
        excludes.addAll(getExcludes());
        ResolutionResult resolutionResult;
        if (!gradleAggregateModules) {
            resolutionResult = new ResolutionResult(projectInfoPathMap, excludes, getDependencyType(), topLevelFolder);
        } else {
            resolutionResult = new ResolutionResult(projectInfoPathMap.keySet().stream()
                    .flatMap(project -> project.getDependencies().stream()).collect(Collectors.toList()), excludes, getDependencyType(), topLevelFolder);
        }
        logger.debug("total projects = {}",resolutionResult.getResolvedProjects().size());
        return resolutionResult;
    }
@ Override protected ResolutionResult resolveDependencies ( String projectFolder , String topLevelFolder , Set < String > bomFiles ) { logger . debug ( "gradleAggregateModules={}" , gradleAggregateModules ) ; this . gradleCli . setTopLevelFolderGradlew ( topLevelFolder ) ; Map < AgentProjectInfo , Path > projectInfoPathMap = new HashMap < > ( ) ; Collection < String > excludes = new HashSet < > ( ) ; if ( gradleRunPreStep ) { downloadMissingDependencies ( projectFolder ) ; } for ( String bomFile : bomFiles ) { String bomFileFolder = new File ( bomFile ) . getParent ( ) ; File bomFolder = new File ( new File ( bomFile ) . getParent ( ) ) ; String moduleName = bomFolder . getName ( ) ; List < String > lines = getDependenciesTree ( bomFileFolder , moduleName ) ; if ( lines != null ) { List < DependencyInfo > dependencies = collectDependencies ( lines , bomFileFolder , bomFileFolder . equals ( topLevelFolder ) , bomFile ) ; if ( dependencies . size ( ) > 0 ) { AgentProjectInfo agentProjectInfo = new AgentProjectInfo ( ) ; agentProjectInfo . getDependencies ( ) . addAll ( dependencies ) ; if ( ! gradleAggregateModules ) { Coordinates coordinates = new Coordinates ( ) ; coordinates . setArtifactId ( moduleName ) ; agentProjectInfo . setCoordinates ( coordinates ) ; } projectInfoPathMap . put ( agentProjectInfo , bomFolder . toPath ( ) ) ; if ( ignoreSourceCode ) { excludes . addAll ( normalizeLocalPath ( projectFolder , topLevelFolder , extensionPattern ( GRADLE_SCRIPT_EXTENSION ) , null ) ) ; } } } } topLevelFoldersNames . add ( topLevelFolder . substring ( topLevelFolder . lastIndexOf ( fileSeparator ) + 1 ) ) ; excludes . addAll ( getExcludes ( ) ) ; ResolutionResult resolutionResult ; if ( ! gradleAggregateModules ) { resolutionResult = new ResolutionResult ( projectInfoPathMap , excludes , getDependencyType ( ) , topLevelFolder ) ; } else { resolutionResult = new ResolutionResult ( projectInfoPathMap . keySet ( ) . stream ( ) . flatMap ( project -> project . getDependencies ( ) . stream ( ) ) . collect ( Collectors . toList ( ) ) , excludes , getDependencyType ( ) , topLevelFolder ) ; } logger . debug ( "total projects = {}" , resolutionResult . getResolvedProjects ( ) . size ( ) ) ; return resolutionResult ; }
/* --- Overridden methods ---