Search in sources :

Example 1 with NugetInspection

use of com.blackducksoftware.integration.hub.detect.detector.nuget.model.NugetInspection in project hub-detect by blackducksoftware.

the class NugetInspectorPackager method createDetectCodeLocation.

public NugetParseResult createDetectCodeLocation(final File dependencyNodeFile) throws IOException {
    final String text = FileUtils.readFileToString(dependencyNodeFile, StandardCharsets.UTF_8);
    final NugetInspection nugetInspection = gson.fromJson(text, NugetInspection.class);
    final List<DetectCodeLocation> codeLocations = new ArrayList<>();
    String projectName = "";
    String projectVersion = "";
    for (final NugetContainer it : nugetInspection.containers) {
        final Optional<NugetParseResult> possibleParseResult = createDetectCodeLocationFromNugetContainer(it);
        if (possibleParseResult.isPresent()) {
            final NugetParseResult result = possibleParseResult.get();
            if (StringUtils.isNotBlank(result.projectName)) {
                projectName = result.projectName;
                projectVersion = result.projectVersion;
            }
            codeLocations.addAll(result.codeLocations);
        }
    }
    return new NugetParseResult(projectName, projectVersion, codeLocations);
}
Also used : NugetInspection(com.blackducksoftware.integration.hub.detect.detector.nuget.model.NugetInspection) DetectCodeLocation(com.blackducksoftware.integration.hub.detect.workflow.codelocation.DetectCodeLocation) NugetContainer(com.blackducksoftware.integration.hub.detect.detector.nuget.model.NugetContainer) ArrayList(java.util.ArrayList)

Aggregations

NugetContainer (com.blackducksoftware.integration.hub.detect.detector.nuget.model.NugetContainer)1 NugetInspection (com.blackducksoftware.integration.hub.detect.detector.nuget.model.NugetInspection)1 DetectCodeLocation (com.blackducksoftware.integration.hub.detect.workflow.codelocation.DetectCodeLocation)1 ArrayList (java.util.ArrayList)1