use of com.synopsys.integration.detectable.detectables.cocoapods.model.Pod in project synopsys-detect by blackducksoftware.
the class PodlockParser method extractDependencyGraph.
public DependencyGraph extractDependencyGraph(String podLockText) throws IOException, MissingExternalIdException {
LazyExternalIdDependencyGraphBuilder lazyBuilder = new LazyExternalIdDependencyGraphBuilder();
YAMLMapper mapper = new YAMLMapper();
PodfileLock podfileLock = mapper.readValue(podLockText, PodfileLock.class);
Map<LazyId, Forge> forgeOverrides = createForgeOverrideMap(podfileLock);
List<String> knownPods = determineAllPodNames(podfileLock);
for (Pod pod : podfileLock.getPods()) {
logger.trace(String.format("Processing pod %s", pod.getName()));
processPod(pod, forgeOverrides, lazyBuilder, knownPods);
}
for (Pod dependency : podfileLock.getDependencies()) {
logger.trace(String.format("Processing pod dependency from pod lock file %s", dependency.getName()));
String podText = dependency.getName();
Optional<LazyId> dependencyId = parseDependencyId(podText);
dependencyId.ifPresent(lazyBuilder::addChildToRoot);
}
logger.trace("Attempting to build the dependency graph.");
DependencyGraph dependencyGraph = lazyBuilder.build();
logger.trace("Completed the dependency graph.");
return dependencyGraph;
}
Aggregations