Search in sources :

Example 1 with Pod

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;
}
Also used : Pod(com.synopsys.integration.detectable.detectables.cocoapods.model.Pod) YAMLMapper(com.fasterxml.jackson.dataformat.yaml.YAMLMapper) LazyExternalIdDependencyGraphBuilder(com.synopsys.integration.bdio.graph.builder.LazyExternalIdDependencyGraphBuilder) Forge(com.synopsys.integration.bdio.model.Forge) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) PodfileLock(com.synopsys.integration.detectable.detectables.cocoapods.model.PodfileLock) LazyId(com.synopsys.integration.bdio.graph.builder.LazyId)

Aggregations

YAMLMapper (com.fasterxml.jackson.dataformat.yaml.YAMLMapper)1 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 LazyExternalIdDependencyGraphBuilder (com.synopsys.integration.bdio.graph.builder.LazyExternalIdDependencyGraphBuilder)1 LazyId (com.synopsys.integration.bdio.graph.builder.LazyId)1 Forge (com.synopsys.integration.bdio.model.Forge)1 Pod (com.synopsys.integration.detectable.detectables.cocoapods.model.Pod)1 PodfileLock (com.synopsys.integration.detectable.detectables.cocoapods.model.PodfileLock)1