Search in sources :

Example 1 with GradleConfiguration

use of com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleConfiguration in project synopsys-detect by blackducksoftware.

the class GradleReportParser method parseConfigurationLines.

private void parseConfigurationLines(List<String> configurationLines, GradleReport gradleReport) {
    if (configurationLines.size() > 1 && isConfigurationHeader(configurationLines)) {
        String header = configurationLines.get(0);
        List<String> dependencyTree = configurationLines.stream().skip(1).collect(Collectors.toList());
        GradleConfiguration configuration = gradleReportConfigurationParser.parse(header, dependencyTree);
        gradleReport.getConfigurations().add(configuration);
    }
}
Also used : GradleConfiguration(com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleConfiguration)

Example 2 with GradleConfiguration

use of com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleConfiguration in project synopsys-detect by blackducksoftware.

the class GradleReportTransformer method transform.

public CodeLocation transform(GradleReport gradleReport) {
    DependencyGraph graph = new BasicDependencyGraph();
    for (GradleConfiguration configuration : gradleReport.getConfigurations()) {
        if (configuration.isResolved() || configurationTypeFilter.shouldInclude(GradleConfigurationType.UNRESOLVED)) {
            logger.trace("Adding configuration to the graph: {}", configuration.getName());
            addConfigurationToGraph(graph, configuration);
        } else {
            logger.trace("Excluding unresolved configuration from the graph: {}", configuration.getName());
        }
    }
    ExternalId projectId = ExternalId.FACTORY.createMavenExternalId(gradleReport.getProjectGroup(), gradleReport.getProjectName(), gradleReport.getProjectVersionName());
    if (StringUtils.isNotBlank(gradleReport.getProjectSourcePath())) {
        return new CodeLocation(graph, projectId, new File(gradleReport.getProjectSourcePath()));
    } else {
        return new CodeLocation(graph, projectId);
    }
}
Also used : CodeLocation(com.synopsys.integration.detectable.detectable.codelocation.CodeLocation) ExternalId(com.synopsys.integration.bdio.model.externalid.ExternalId) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) BasicDependencyGraph(com.synopsys.integration.bdio.graph.BasicDependencyGraph) GradleConfiguration(com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleConfiguration) File(java.io.File)

Example 3 with GradleConfiguration

use of com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleConfiguration in project synopsys-detect by blackducksoftware.

the class GradleReportConfigurationParser method parse.

public GradleConfiguration parse(String header, List<String> dependencyLines) {
    GradleConfiguration configuration = new GradleConfiguration();
    configuration.setName(parseConfigurationName(header));
    configuration.setUnresolved(parseUnresolved(header));
    configuration.setChildren(dependencyLines.stream().map(parser::parseLine).collect(Collectors.toList()));
    return configuration;
}
Also used : GradleConfiguration(com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleConfiguration)

Aggregations

GradleConfiguration (com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleConfiguration)3 BasicDependencyGraph (com.synopsys.integration.bdio.graph.BasicDependencyGraph)1 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 ExternalId (com.synopsys.integration.bdio.model.externalid.ExternalId)1 CodeLocation (com.synopsys.integration.detectable.detectable.codelocation.CodeLocation)1 File (java.io.File)1