use of com.synopsys.integration.bdio.graph.BasicDependencyGraph in project synopsys-detect by blackducksoftware.
the class GoVendorJsonParser method parseVendorJson.
public DependencyGraph parseVendorJson(Gson gson, String vendorJsonContents) {
DependencyGraph graph = new BasicDependencyGraph();
VendorJson vendorJsonData = gson.fromJson(vendorJsonContents, VendorJson.class);
logger.trace(String.format("vendorJsonData: %s", vendorJsonData));
for (PackageData pkg : vendorJsonData.getPackages()) {
if (StringUtils.isNotBlank(pkg.getPath()) && StringUtils.isNotBlank(pkg.getRevision())) {
ExternalId dependencyExternalId = externalIdFactory.createNameVersionExternalId(Forge.GOLANG, pkg.getPath(), pkg.getRevision());
Dependency dependency = new Dependency(pkg.getPath(), pkg.getRevision(), dependencyExternalId);
logger.trace(String.format("dependency: %s", dependency.getExternalId().toString()));
graph.addChildToRoot(dependency);
} else {
logger.debug(String.format("Omitting package path:'%s', revision:'%s' (one or both of path, revision is/are missing)", pkg.getPath(), pkg.getRevision()));
}
}
return graph;
}
use of com.synopsys.integration.bdio.graph.BasicDependencyGraph in project synopsys-detect by blackducksoftware.
the class MavenCodeLocationPackager method initializeCurrentMavenProject.
private void initializeCurrentMavenProject(ExcludedIncludedWildcardFilter modulesFilter, String sourcePath, String line) {
// this is the first line of a new code location, the following lines will be the tree of dependencies for this code location
currentGraph = new BasicDependencyGraph();
MavenParseResult mavenProject = createMavenParseResult(sourcePath, line, currentGraph);
if (null != mavenProject && modulesFilter.shouldInclude(mavenProject.getProjectName())) {
logger.trace(String.format("Project: %s", mavenProject.getProjectName()));
this.currentMavenProject = mavenProject;
codeLocations.add(mavenProject);
} else {
logger.trace("Project: unknown");
currentMavenProject = null;
dependencyParentStack.clear();
parsingProjectSection = false;
level = 0;
}
}
use of com.synopsys.integration.bdio.graph.BasicDependencyGraph in project synopsys-detect by blackducksoftware.
the class VndrParser method parseVendorConf.
public DependencyGraph parseVendorConf(List<String> vendorConfContents) {
DependencyGraph graph = new BasicDependencyGraph();
vendorConfContents.stream().filter(this::shouldIncludeLine).map(this::parseLineToDependency).filter(Optional::isPresent).map(Optional::get).forEach(graph::addChildToRoot);
return graph;
}
use of com.synopsys.integration.bdio.graph.BasicDependencyGraph in project synopsys-detect by blackducksoftware.
the class SbtGraphParserTransformer method transformDotToGraph.
public DependencyGraph transformDotToGraph(GraphParser graphParser, String projectNodeId) {
DependencyGraph graph = new BasicDependencyGraph();
for (GraphEdge graphEdge : graphParser.getEdges().values()) {
Dependency parent = sbtDotGraphNodeParser.nodeToDependency(graphEdge.getNode1().getId());
Dependency child = sbtDotGraphNodeParser.nodeToDependency(graphEdge.getNode2().getId());
if (projectNodeId.equals(graphEdge.getNode1().getId())) {
graph.addChildToRoot(child);
} else {
graph.addChildWithParent(child, parent);
}
}
return graph;
}
use of com.synopsys.integration.bdio.graph.BasicDependencyGraph in project synopsys-detect by blackducksoftware.
the class SbtGraphParserTransformer method transformDotToGraph.
public DependencyGraph transformDotToGraph(GraphParser graphParser, Set<String> projectNodeIds) {
DependencyGraph graph = new BasicDependencyGraph();
for (GraphEdge graphEdge : graphParser.getEdges().values()) {
Dependency parent = sbtDotGraphNodeParser.nodeToDependency(graphEdge.getNode1().getId());
Dependency child = sbtDotGraphNodeParser.nodeToDependency(graphEdge.getNode2().getId());
if (projectNodeIds.contains(graphEdge.getNode1().getId())) {
graph.addChildToRoot(parent);
}
graph.addChildWithParent(child, parent);
}
return graph;
}
Aggregations