use of com.synopsys.integration.detectable.detectables.go.vendor.model.VendorJson 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;
}
Aggregations