use of com.blackducksoftware.integration.hub.bdio.graph.MutableMapDependencyGraph in project hub-detect by blackducksoftware.
the class CondaListParser method parse.
public DependencyGraph parse(String listJsonText, String infoJsonText) {
final Type listType = new TypeToken<ArrayList<CondaListElement>>() {
}.getType();
final List<CondaListElement> condaList = gson.fromJson(listJsonText, listType);
final CondaInfo condaInfo = gson.fromJson(infoJsonText, CondaInfo.class);
final String platform = condaInfo.getPlatform();
MutableDependencyGraph graph = new MutableMapDependencyGraph();
for (CondaListElement condaListElement : condaList) {
graph.addChildToRoot(condaListElementToDependency(platform, condaListElement));
}
return graph;
}
use of com.blackducksoftware.integration.hub.bdio.graph.MutableMapDependencyGraph in project hub-detect by blackducksoftware.
the class CpanPackager method makeDependencyGraph.
public DependencyGraph makeDependencyGraph(List<String> cpanListText, List<String> directDependenciesText) {
Map<String, NameVersionNode> allModules = cpanListParser.parse(cpanListText);
List<String> directModuleNames = getDirectModuleNames(directDependenciesText);
MutableDependencyGraph graph = new MutableMapDependencyGraph();
for (String moduleName : directModuleNames) {
NameVersionNode nameVersionNode = allModules.get(moduleName);
if (null != nameVersionNode) {
nameVersionNode.setName(nameVersionNode.getName().replace("::", "-"));
Dependency module = nameVersionNodeTransformer.addNameVersionNodeToDependencyGraph(graph, Forge.CPAN, nameVersionNode);
graph.addChildToRoot(module);
} else {
logger.warn(String.format("Could node find resolved version for module: %s", moduleName));
}
}
return graph;
}
use of com.blackducksoftware.integration.hub.bdio.graph.MutableMapDependencyGraph in project hub-detect by blackducksoftware.
the class NameVersionNodeTransformer method createDependencyGraph.
public DependencyGraph createDependencyGraph(final Forge defaultForge, final NameVersionNode nameVersionNode, final Boolean rootIsRealRoot) {
final MutableDependencyGraph graph = new MutableMapDependencyGraph();
final Dependency root = addNameVersionNodeToDependencyGraph(graph, defaultForge, nameVersionNode);
if (rootIsRealRoot) {
graph.addChildToRoot(root);
} else {
graph.addChildrenToRoot(graph.getChildrenForParent(root));
}
return graph;
}
use of com.blackducksoftware.integration.hub.bdio.graph.MutableMapDependencyGraph in project hub-detect by blackducksoftware.
the class GradleReportParser method clearState.
private void clearState() {
rootProjectName = "";
rootProjectVersionName = "";
projectSourcePath = "";
projectGroup = "";
projectName = "";
projectVersionName = "";
processingMetaData = false;
graph = new MutableMapDependencyGraph();
nodeStack = new Stack<>();
previousNode = null;
clearConfigurationState();
}
use of com.blackducksoftware.integration.hub.bdio.graph.MutableMapDependencyGraph in project hub-detect by blackducksoftware.
the class CocoapodsPackager method extractDependencyGraph.
public DependencyGraph extractDependencyGraph(final String podLockText) throws IOException {
YAMLMapper mapper = new YAMLMapper();
PodfileLock podfileLock = mapper.readValue(podLockText, PodfileLock.class);
NameVersionNode root = new NameVersionNode();
root.setName(String.format("detectRootNode - %s", UUID.randomUUID()));
final SubcomponentNodeBuilder builder = new SubcomponentNodeBuilder(root);
for (Pod pod : podfileLock.getPods()) {
buildNameVersionNode(builder, pod);
}
;
for (Pod dependency : podfileLock.getDependencies()) {
NameVersionNode child = new NameVersionNode();
child.setName(cleanPodName(dependency.getName()));
builder.addChildNodeToParent(child, root);
}
;
if (null != podfileLock.getExternalSources() && !podfileLock.getExternalSources().getSources().isEmpty()) {
for (PodSource podSource : podfileLock.getExternalSources().getSources()) {
NodeMetadata nodeMetadata = createMetadata(builder, podSource.getName());
if (null != podSource.getGit() && podSource.getGit().contains("github")) {
// Change the forge to GitHub when there is better KB support
nodeMetadata.setForge(Forge.COCOAPODS);
} else if (null != podSource.getPath() && podSource.getPath().contains("node_modules")) {
nodeMetadata.setForge(Forge.NPM);
}
}
}
MutableDependencyGraph graph = new MutableMapDependencyGraph();
for (NameVersionNode nameVersionNode : builder.build().getChildren()) {
Dependency childDependency = nameVersionNodeTransformer.addNameVersionNodeToDependencyGraph(graph, Forge.COCOAPODS, nameVersionNode);
graph.addChildToRoot(childDependency);
}
return graph;
}
Aggregations