use of com.blackducksoftware.integration.hub.detect.nameversion.metadata.SubcomponentMetadata in project hub-detect by blackducksoftware.
the class CocoapodsPackager method createMetadata.
private SubcomponentMetadata createMetadata(NameVersionNodeBuilder builder, String name) {
SubcomponentMetadata metadata = (SubcomponentMetadata) builder.getNodeMetadata(cleanPodName(name));
if (null == metadata) {
metadata = new SubcomponentMetadata();
builder.setMetadata(name, metadata);
}
return metadata;
}
use of com.blackducksoftware.integration.hub.detect.nameversion.metadata.SubcomponentMetadata in project hub-detect by blackducksoftware.
the class CocoapodsPackager method buildNameVersionNode.
private NameVersionNode buildNameVersionNode(SubcomponentNodeBuilder builder, Pod pod) {
NameVersionNode nameVersionNode = new NameVersionNode();
nameVersionNode.setName(cleanPodName(pod.getName()));
pod.setCleanName(nameVersionNode.getName());
String[] segments = pod.getName().split(" ");
if (segments.length > 1) {
String version = segments[1];
version = version.replace("(", "").replace(")", "").trim();
if (!isVersionFuzzy(version)) {
nameVersionNode.setVersion(version);
}
}
for (String dependency : pod.getDependencies()) {
builder.addChildNodeToParent(buildNameVersionNode(builder, new Pod(dependency)), nameVersionNode);
}
if (pod.getDependencies().isEmpty()) {
builder.addToCache(nameVersionNode);
}
if (nameVersionNode.getName().contains("/")) {
String superNodeName = nameVersionNode.getName().split("/")[0].trim();
NameVersionNode superNode = new NameVersionNode();
superNode.setName(superNodeName);
superNode = builder.addToCache(superNode);
SubcomponentMetadata superNodeMetadata = createMetadata(builder, superNode.getName());
superNodeMetadata.getSubcomponents().add(nameVersionNode);
SubcomponentMetadata subcomponentMetadata = createMetadata(builder, nameVersionNode.getName());
subcomponentMetadata.setLinkNode(superNode);
builder.getSuperComponents().add(superNode);
}
return nameVersionNode;
}
Aggregations