use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class PearParser method parsePearDependencyList.
public DependencyGraph parsePearDependencyList(final ExecutableOutput pearListing, final ExecutableOutput pearDependencies) {
DependencyGraph graph = new MutableMapDependencyGraph();
if (StringUtils.isNotBlank(pearDependencies.getErrorOutput()) || StringUtils.isNotBlank(pearListing.getErrorOutput())) {
logger.error("There was an error during execution.");
if (StringUtils.isNotBlank(pearListing.getErrorOutput())) {
logger.error("Pear list error: ");
logger.error(pearListing.getErrorOutput());
}
if (StringUtils.isNotBlank(pearDependencies.getErrorOutput())) {
logger.error("Pear package-dependencies error: ");
logger.error(pearDependencies.getErrorOutput());
}
} else if (!(pearDependencies.getStandardOutputAsList().size() > 0) || !(pearListing.getStandardOutputAsList().size() > 0)) {
logger.error("No information retrieved from running pear commands");
} else {
final List<String> nameList = findDependencyNames(pearDependencies.getStandardOutputAsList());
graph = createPearDependencyGraphFromList(pearListing.getStandardOutputAsList(), nameList);
}
return graph;
}
use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class NugetInspectorPackager method createDetectCodeLocationFromNugetContainer.
private Optional<NugetParseResult> createDetectCodeLocationFromNugetContainer(final NugetContainer nugetContainer) {
final NugetParseResult parseResult;
String projectName = "";
String projectVersionName = "";
if (NugetContainerType.SOLUTION == nugetContainer.type) {
projectName = nugetContainer.name;
projectVersionName = nugetContainer.version;
final List<DetectCodeLocation> codeLocations = new ArrayList<>();
for (final NugetContainer container : nugetContainer.children) {
final NugetDependencyNodeBuilder builder = new NugetDependencyNodeBuilder(externalIdFactory);
builder.addPackageSets(container.packages);
final DependencyGraph children = builder.createDependencyGraph(container.dependencies);
final String sourcePath = container.sourcePath;
if (StringUtils.isBlank(projectVersionName)) {
projectVersionName = container.version;
}
final DetectCodeLocation codeLocation = new DetectCodeLocation.Builder(DetectCodeLocationType.NUGET, sourcePath, externalIdFactory.createNameVersionExternalId(Forge.NUGET, projectName, projectVersionName), children).build();
codeLocations.add(codeLocation);
}
parseResult = new NugetParseResult(projectName, projectVersionName, codeLocations);
} else if (NugetContainerType.PROJECT == nugetContainer.type) {
projectName = nugetContainer.name;
projectVersionName = nugetContainer.version;
final String sourcePath = nugetContainer.sourcePath;
final NugetDependencyNodeBuilder builder = new NugetDependencyNodeBuilder(externalIdFactory);
builder.addPackageSets(nugetContainer.packages);
final DependencyGraph children = builder.createDependencyGraph(nugetContainer.dependencies);
final DetectCodeLocation codeLocation = new DetectCodeLocation.Builder(DetectCodeLocationType.NUGET, sourcePath, externalIdFactory.createNameVersionExternalId(Forge.NUGET, projectName, projectVersionName), children).build();
parseResult = new NugetParseResult(projectName, projectVersionName, codeLocation);
} else {
parseResult = null;
}
return Optional.ofNullable(parseResult);
}
use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class GemlockNodeParserTest method testParsingEqualsGemfileLock.
@Test
public void testParsingEqualsGemfileLock() {
final String text = testUtils.getResourceAsUTF8String("/rubygems/Gemfile_equals_version.lock");
final List<String> gemfileLockContents = Arrays.asList(text.split("\n"));
final GemlockParser gemlockNodeParser = new GemlockParser(new ExternalIdFactory());
final DependencyGraph dependencyGraph = gemlockNodeParser.parseProjectDependencies(gemfileLockContents);
Dependency bundler = dependencyGraph.getDependency(new ExternalIdFactory().createNameVersionExternalId(Forge.RUBYGEMS, "bundler", "1.11.2"));
assertNotNull(bundler);
}
use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class GemlockNodeParserTest method testMissingVersionsGemfileLock.
@Test
public void testMissingVersionsGemfileLock() {
final String text = testUtils.getResourceAsUTF8String("/rubygems/Gemfile_missing_versions.lock");
final List<String> gemfileLockContents = Arrays.asList(text.split("\n"));
final GemlockParser gemlockNodeParser = new GemlockParser(new ExternalIdFactory());
final DependencyGraph dependencyGraph = gemlockNodeParser.parseProjectDependencies(gemfileLockContents);
Dependency newrelic_rpm = dependencyGraph.getDependency(new ExternalIdFactory().createNameVersionExternalId(Forge.RUBYGEMS, "newrelic_rpm", ""));
assertNotNull(newrelic_rpm);
}
use of com.synopsys.integration.bdio.graph.DependencyGraph in project hub-detect by blackducksoftware.
the class YarnListParserTest method parseYarnListTest.
@Test
public void parseYarnListTest() {
final List<String> designedYarnLock = new ArrayList<>();
designedYarnLock.add("async@~0.9.0:");
designedYarnLock.add(" version \"0.9.2\"");
designedYarnLock.add(" resolved \"http://nexus/nexus3/repository/npm-all/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d\"");
designedYarnLock.add(" dependencies:");
designedYarnLock.add(" minimist \"0.0.8\"");
designedYarnLock.add("");
designedYarnLock.add("minimist@0.0.8:");
designedYarnLock.add(" version \"0.0.8\"");
designedYarnLock.add(" resolved \"http://nexus/nexus3/repository/npm-all/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d\"");
final ExternalIdFactory externalIdFactory = new ExternalIdFactory();
final YarnLockParser yarnLockParser = new YarnLockParser();
final YarnListParser yarnListParser = new YarnListParser(externalIdFactory, yarnLockParser);
final String yarnListText = testUtil.getResourceAsUTF8String("/yarn/yarn.list.txt");
final DependencyGraph dependencyGraph = yarnListParser.parseYarnList(designedYarnLock, Arrays.asList(yarnListText.split(System.lineSeparator())));
DependencyGraphResourceTestUtil.assertGraph("/yarn/list_expected_graph.json", dependencyGraph);
}
Aggregations