Search in sources :

Example 6 with DependencyHistory

use of com.synopsys.integration.detectable.detectable.util.DependencyHistory in project synopsys-detect by blackducksoftware.

the class PubDepsParser method parseLines.

private void parseLines(List<String> lines, Map<String, String> resolvedVersions, MutableDependencyGraph dependencyGraph) {
    DependencyHistory dependencyHistory = new DependencyHistory();
    for (String line : lines) {
        int depthOfLine = calculateDepth(line);
        if (depthOfLine == 0) {
            // non-graph line
            continue;
        }
        int dependencyDepth = depthOfLine - 1;
        dependencyHistory.clearDependenciesDeeperThan(dependencyDepth);
        String nameOfDependency = parseNameFromlLine(line);
        Dependency dependency = createDependency(nameOfDependency, resolvedVersions);
        if (dependencyHistory.isEmpty()) {
            dependencyGraph.addChildToRoot(dependency);
        } else {
            dependencyGraph.addChildWithParent(dependency, dependencyHistory.getLastDependency());
        }
        dependencyHistory.add(dependency);
    }
}
Also used : DependencyHistory(com.synopsys.integration.detectable.detectable.util.DependencyHistory) Dependency(com.synopsys.integration.bdio.model.dependency.Dependency)

Aggregations

DependencyHistory (com.synopsys.integration.detectable.detectable.util.DependencyHistory)6 Dependency (com.synopsys.integration.bdio.model.dependency.Dependency)4 BasicDependencyGraph (com.synopsys.integration.bdio.graph.BasicDependencyGraph)2 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)2 CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)2 GradleGav (com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleGav)2 GradleTreeNode (com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleTreeNode)2 NameVersionCodeLocation (com.synopsys.integration.detectable.detectables.pip.inspector.model.NameVersionCodeLocation)1 RebarParseResult (com.synopsys.integration.detectable.detectables.rebar.model.RebarParseResult)1 NameVersion (com.synopsys.integration.util.NameVersion)1