use of com.synopsys.integration.bdio.graph.MutableMapDependencyGraph in project hub-detect by blackducksoftware.
the class SbtDependencyResolver method resolveReport.
public SbtDependencyModule resolveReport(final SbtReport report) {
final ExternalId rootId = externalIdFactory.createMavenExternalId(report.getOrganisation(), report.getModule(), report.getRevision());
logger.debug("Created external id: " + rootId.toString());
final MutableDependencyGraph graph = new MutableMapDependencyGraph();
logger.debug("Dependencies found: " + report.getDependencies().size());
report.getDependencies().forEach(module -> {
logger.debug("Revisions found: " + module.getRevisions().size());
module.getRevisions().forEach(revision -> {
logger.debug("Callers found: " + revision.getCallers().size());
final ExternalId id = externalIdFactory.createMavenExternalId(module.getOrganisation(), module.getName(), revision.getName());
final Dependency child = new Dependency(module.getName(), revision.getName(), id);
revision.getCallers().forEach(caller -> {
final ExternalId parentId = externalIdFactory.createMavenExternalId(caller.getOrganisation(), caller.getName(), caller.getRevision());
final Dependency parent = new Dependency(caller.getName(), caller.getRevision(), parentId);
logger.debug("Caller id: " + parentId.toString());
if (rootId.equals(parentId)) {
graph.addChildToRoot(child);
} else {
graph.addParentWithChild(parent, child);
}
});
});
});
final SbtDependencyModule module = new SbtDependencyModule();
module.name = report.getModule();
module.version = report.getRevision();
module.org = report.getOrganisation();
module.graph = graph;
module.configuration = report.getConfiguration();
return module;
}
Aggregations