use of com.synopsys.integration.bdio.model.dependencyid.NameVersionDependencyId in project hub-detect by blackducksoftware.
the class PackRatNodeParser method parseProjectDependencies.
DependencyGraph parseProjectDependencies(final List<String> packratLockContents) {
final LazyExternalIdDependencyGraphBuilder graphBuilder = new LazyExternalIdDependencyGraphBuilder();
DependencyId currentParent = null;
String name = null;
String version = null;
for (final String line : packratLockContents) {
if (line.startsWith("PackratFormat:") || line.startsWith("PackratVersion:") || line.startsWith("RVersion:")) {
continue;
}
if (line.contains("Package: ")) {
name = line.replace("Package: ", "").trim();
currentParent = new NameDependencyId(name);
graphBuilder.setDependencyName(currentParent, name);
graphBuilder.addChildToRoot(currentParent);
version = null;
continue;
}
if (line.contains("Version: ")) {
version = line.replace("Version: ", "").trim();
graphBuilder.setDependencyVersion(currentParent, version);
final DependencyId realId = new NameVersionDependencyId(name, version);
final ExternalId externalId = this.externalIdFactory.createNameVersionExternalId(Forge.CRAN, name, version);
graphBuilder.setDependencyAsAlias(realId, currentParent);
graphBuilder.setDependencyInfo(realId, name, version, externalId);
currentParent = realId;
}
if (line.contains("Requires: ")) {
final String[] parts = line.replace("Requires: ", "").split(",");
for (int i = 0; i < parts.length; i++) {
final String childName = parts[i].trim();
graphBuilder.addParentWithChild(currentParent, new NameDependencyId(childName));
}
}
}
return graphBuilder.build();
}
use of com.synopsys.integration.bdio.model.dependencyid.NameVersionDependencyId in project hub-detect by blackducksoftware.
the class GemlockParser method parseSpecPackageLine.
private void parseSpecPackageLine(final String trimmedLine) {
final NameVersion parentNameVersion = parseNameVersion(trimmedLine);
if (StringUtils.isNotBlank(parentNameVersion.getVersion())) {
currentParent = new NameDependencyId(parentNameVersion.getName());
discoveredDependencyInfo(new NameVersionDependencyId(parentNameVersion.getName(), parentNameVersion.getVersion()));
} else {
logger.error(String.format("An installed spec did not have a non-fuzzy version: %s", trimmedLine));
}
}
use of com.synopsys.integration.bdio.model.dependencyid.NameVersionDependencyId in project hub-detect by blackducksoftware.
the class GemlockParser method addBundlerDependency.
private void addBundlerDependency(final String trimmedLine) {
final NameVersionDependencyId bundlerId = new NameVersionDependencyId("bundler", trimmedLine);
discoveredDependencyInfo(bundlerId);
}
use of com.synopsys.integration.bdio.model.dependencyid.NameVersionDependencyId 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;
}
Aggregations