use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class NpmDependencyConverter method createNpmDependency.
private NpmDependency createNpmDependency(String name, String version, Boolean isDev) {
ExternalId externalId = externalIdFactory.createNameVersionExternalId(Forge.NPM, name, version);
Dependency graphDependency = new Dependency(name, version, externalId);
boolean dev = false;
if (isDev != null && isDev == true) {
dev = true;
}
return new NpmDependency(name, version, dev, graphDependency);
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class MavenCodeLocationPackager method addOrphansToGraph.
private void addOrphansToGraph(final MutableDependencyGraph graph, final List<Dependency> orphans) {
logger.trace(String.format("# orphans: %d", orphans.size()));
if (orphans.size() > 0) {
final Dependency orphanListParent = createOrphanListParentDependency();
logger.trace(String.format("adding orphan list parent dependency: %s", orphanListParent.externalId.toString()));
graph.addChildToRoot(orphanListParent);
for (Dependency dependency : orphans) {
logger.trace(String.format("adding orphan: %s", dependency.externalId.toString()));
graph.addParentWithChild(orphanListParent, dependency);
}
}
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class MavenCodeLocationPackager method textToProject.
Dependency textToProject(final String componentText) {
if (!isGav(componentText)) {
return null;
}
final String[] gavParts = componentText.split(":");
final String group = gavParts[0];
final String artifact = gavParts[1];
String version;
if (gavParts.length == 4) {
// Dependency does not include the classifier
version = gavParts[gavParts.length - 1];
} else if (gavParts.length == 5) {
// Dependency does include the classifier
version = gavParts[gavParts.length - 1];
} else {
logger.debug(String.format("%s does not look like a dependency we can parse", componentText));
return null;
}
final ExternalId externalId = externalIdFactory.createMavenExternalId(group, artifact, version);
return new Dependency(artifact, version, externalId);
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class VndrParser method parseVendorConf.
public DependencyGraph parseVendorConf(final List<String> vendorConfContents) {
final MutableDependencyGraph graph = new MutableMapDependencyGraph();
// TODO test against moby
vendorConfContents.forEach(line -> {
if (StringUtils.isNotBlank(line) && !line.startsWith("#")) {
final String[] parts = line.split(" ");
final ExternalId dependencyExternalId = externalIdFactory.createNameVersionExternalId(Forge.GOLANG, parts[0], parts[1]);
final Dependency dependency = new Dependency(parts[0], parts[1], dependencyExternalId);
graph.addChildToRoot(dependency);
}
});
return graph;
}
use of com.synopsys.integration.bdio.model.dependency.Dependency in project hub-detect by blackducksoftware.
the class CpanListParser method parse.
public DependencyGraph parse(final List<String> cpanListText, final List<String> directDependenciesText) {
final Map<String, String> nameVersionMap = createNameVersionMap(cpanListText);
final List<String> directModuleNames = getDirectModuleNames(directDependenciesText);
final MutableDependencyGraph graph = new MutableMapDependencyGraph();
for (final String moduleName : directModuleNames) {
final String version = nameVersionMap.get(moduleName);
if (null != version) {
final String name = moduleName.replace("::", "-");
final ExternalId externalId = externalIdFactory.createNameVersionExternalId(Forge.CPAN, name, version);
final Dependency dependency = new Dependency(name, version, externalId);
graph.addChildToRoot(dependency);
} else {
logger.warn(String.format("Could node find resolved version for module: %s", moduleName));
}
}
return graph;
}
Aggregations