use of com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleGav in project synopsys-detect by blackducksoftware.
the class GradleReportTransformer method addConfigurationToGraph.
private void addConfigurationToGraph(MutableDependencyGraph graph, GradleConfiguration configuration) {
DependencyHistory history = new DependencyHistory();
TreeNodeSkipper treeNodeSkipper = new TreeNodeSkipper();
for (GradleTreeNode currentNode : configuration.getChildren()) {
if (treeNodeSkipper.shouldSkip(currentNode)) {
continue;
}
if (currentNode.getNodeType() == GradleTreeNode.NodeType.GAV) {
history.clearDependenciesDeeperThan(currentNode.getLevel());
Optional<GradleGav> currentNodeGav = currentNode.getGav();
if (currentNodeGav.isPresent()) {
addGavToGraph(currentNodeGav.get(), history, graph);
} else {
// We know this is a GradleTreeNode.NodeType.GAV
// So if its missing data, something is probably wrong.
logger.debug("Missing expected GAV from known NodeType. {}", currentNode);
}
} else {
treeNodeSkipper.skipUntilLineLevel(currentNode.getLevel());
}
}
}
use of com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleGav in project synopsys-detect by blackducksoftware.
the class GradleReportTransformer method addConfigurationToGraph.
private void addConfigurationToGraph(DependencyGraph graph, GradleConfiguration configuration) {
DependencyHistory history = new DependencyHistory();
TreeNodeSkipper treeNodeSkipper = new TreeNodeSkipper();
for (GradleTreeNode currentNode : configuration.getChildren()) {
if (treeNodeSkipper.shouldSkip(currentNode)) {
continue;
}
if (currentNode.getNodeType() == GradleTreeNode.NodeType.GAV) {
history.clearDependenciesDeeperThan(currentNode.getLevel());
Optional<GradleGav> currentNodeGav = currentNode.getGav();
if (currentNodeGav.isPresent()) {
addGavToGraph(currentNodeGav.get(), history, graph);
} else {
// We know this is a GradleTreeNode.NodeType.GAV
// So if its missing data, something is probably wrong.
logger.debug("Missing expected GAV from known NodeType. {}", currentNode);
}
} else {
treeNodeSkipper.skipUntilLineLevel(currentNode.getLevel());
}
}
}
use of com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleGav in project synopsys-detect by blackducksoftware.
the class GradleReportLineTest method assertDependency.
private void assertDependency(String line, String[] expectedResults) {
ExternalIdFactory externalIdFactory = new ExternalIdFactory();
GradleReportLineParser gradleReportLineParser = new GradleReportLineParser();
GradleTreeNode gradleTreeNode = gradleReportLineParser.parseLine(line);
GradleGav gav = gradleTreeNode.getGav().get();
ExternalId externalId = externalIdFactory.createMavenExternalId(gav.getGroup(), gav.getName(), gav.getVersion());
Dependency dependency = new Dependency(gav.getName(), gav.getVersion(), externalId);
Assertions.assertEquals(expectedResults[0], dependency.getExternalId().getGroup());
Assertions.assertEquals(expectedResults[1], dependency.getName());
Assertions.assertEquals(expectedResults[2], dependency.getVersion());
Assertions.assertEquals(expectedResults[3], dependency.getExternalId().createExternalId());
}
use of com.synopsys.integration.detectable.detectables.gradle.inspection.model.GradleGav in project synopsys-detect by blackducksoftware.
the class GradleReportParserTest method assertParsedGavDoesNotContain.
private void assertParsedGavDoesNotContain(String line, String contains) {
GradleReportLineParser gradleReportLineParser = new GradleReportLineParser();
GradleTreeNode node = gradleReportLineParser.parseLine(line);
assertTrue(node.getGav().isPresent());
GradleGav gav = node.getGav().get();
assertFalse(gav.getVersion().contains(contains));
}
Aggregations