Search in sources :

Example 1 with Project

use of com.synopsys.integration.detectable.detectables.go.godep.model.Project in project synopsys-detect by blackducksoftware.

the class GoLockParser method parseDepLock.

public DependencyGraph parseDepLock(InputStream depLockInputStream) {
    DependencyGraph graph = new BasicDependencyGraph();
    GoLock goLock = new Toml().read(depLockInputStream).to(GoLock.class);
    if (goLock.projects != null) {
        for (Project project : goLock.projects) {
            if (project != null) {
                String projectName = project.getName();
                String projectVersion = Optional.ofNullable(StringUtils.stripToNull(project.getVersion())).orElse(project.getRevision());
                project.getPackages().stream().map(packageName -> createDependencyName(projectName, packageName)).map(dependencyName -> createGoDependency(dependencyName, projectVersion)).forEach(graph::addChildToRoot);
            }
        }
    }
    return graph;
}
Also used : DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Forge(com.synopsys.integration.bdio.model.Forge) Dependency(com.synopsys.integration.bdio.model.dependency.Dependency) Toml(com.moandjiezana.toml.Toml) Optional(java.util.Optional) Project(com.synopsys.integration.detectable.detectables.go.godep.model.Project) GoLock(com.synopsys.integration.detectable.detectables.go.godep.model.GoLock) StringUtils(org.apache.commons.lang3.StringUtils) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) InputStream(java.io.InputStream) Project(com.synopsys.integration.detectable.detectables.go.godep.model.Project) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) GoLock(com.synopsys.integration.detectable.detectables.go.godep.model.GoLock) Toml(com.moandjiezana.toml.Toml)

Aggregations

Toml (com.moandjiezana.toml.Toml)1 BasicDependencyGraph (com.synopsys.integration.bdio.graph.BasicDependencyGraph)1 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 Forge (com.synopsys.integration.bdio.model.Forge)1 Dependency (com.synopsys.integration.bdio.model.dependency.Dependency)1 GoLock (com.synopsys.integration.detectable.detectables.go.godep.model.GoLock)1 Project (com.synopsys.integration.detectable.detectables.go.godep.model.Project)1 InputStream (java.io.InputStream)1 Optional (java.util.Optional)1 StringUtils (org.apache.commons.lang3.StringUtils)1