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);
}
Aggregations