use of com.synopsys.integration.bdio.model.dependencyid.NameDependencyId in project hub-detect by blackducksoftware.
the class GemlockParser method processNameVersion.
// If you have Version, you know everything. Otherwise, you need to find this version later.
// Generally each parse/process call should either call this or add to encountered.
private DependencyId processNameVersion(NameVersion nameVersion) {
NameDependencyId nameDependencyId = new NameDependencyId(nameVersion.getName());
if (StringUtils.isNotBlank(nameVersion.getVersion())) {
NameVersionDependencyId nameVersionDependencyId = new NameVersionDependencyId(nameVersion.getName(), nameVersion.getVersion());
discoveredDependencyInfo(nameVersionDependencyId);
} else {
encounteredDependencies.add(nameVersion.getName());
}
return nameDependencyId;
}
use of com.synopsys.integration.bdio.model.dependencyid.NameDependencyId in project hub-detect by blackducksoftware.
the class GemlockParser method parseProjectDependencies.
public DependencyGraph parseProjectDependencies(final List<String> gemfileLockLines) {
encounteredDependencies = new ArrayList<>();
resolvedDependencies = new ArrayList<>();
lazyBuilder = new LazyExternalIdDependencyGraphBuilder();
currentParent = null;
for (final String line : gemfileLockLines) {
final String trimmedLine = StringUtils.trimToEmpty(line);
if (StringUtils.isBlank(trimmedLine)) {
currentSection = NONE;
} else if (SPECS_HEADER.equals(trimmedLine)) {
currentSection = SPECS;
} else if (DEPENDENCIES_HEADER.equals(trimmedLine)) {
currentSection = DEPENDENCIES;
} else if (BUNDLED_WITH_HEADER.equals(trimmedLine)) {
currentSection = BUNDLED_WITH;
} else if (BUNDLED_WITH.equals(currentSection)) {
addBundlerDependency(trimmedLine);
} else if (SPECS.equals(currentSection)) {
parseSpecsSectionLine(line);
} else if (DEPENDENCIES.equals(currentSection)) {
parseDependencySectionLine(trimmedLine);
}
}
List<String> missingDependencies = encounteredDependencies.stream().filter(it -> !resolvedDependencies.contains(it)).collect(Collectors.toList());
for (final String missingName : missingDependencies) {
String missingVersion = "";
final DependencyId dependencyId = new NameDependencyId(missingName);
final ExternalId externalId = externalIdFactory.createNameVersionExternalId(Forge.RUBYGEMS, missingName, missingVersion);
lazyBuilder.setDependencyInfo(dependencyId, missingName, missingVersion, externalId);
}
return lazyBuilder.build();
}
Aggregations