use of com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocation in project synopsys-detect by blackducksoftware.
the class CodeLocationReporter method writeBomToolEvaluationDetails.
private void writeBomToolEvaluationDetails(ReportWriter writer, DetectorEvaluation evaluation, Map<DetectCodeLocation, Integer> dependencyCounts, Map<CodeLocation, DetectCodeLocation> detectCodeLocationMap, Map<DetectCodeLocation, String> codeLocationNameMap) {
for (CodeLocation codeLocation : evaluation.getExtraction().getCodeLocations()) {
DetectExtractionEnvironment detectExtractionEnvironment = (DetectExtractionEnvironment) evaluation.getExtractionEnvironment();
DetectCodeLocation detectCodeLocation = detectCodeLocationMap.get(codeLocation);
writeCodeLocationDetails(writer, detectCodeLocation, dependencyCounts.get(detectCodeLocation), codeLocationNameMap.get(detectCodeLocation), detectExtractionEnvironment.getExtractionId().toUniqueString());
}
}
use of com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocation in project synopsys-detect by blackducksoftware.
the class CodeLocationConverter method toDetectCodeLocation.
public Map<CodeLocation, DetectCodeLocation> toDetectCodeLocation(File detectSourcePath, DetectorEvaluation evaluation) {
Map<CodeLocation, DetectCodeLocation> detectCodeLocations = new HashMap<>();
if (evaluation.wasExtractionSuccessful()) {
Extraction extraction = evaluation.getExtraction();
String name = evaluation.getDetectorType().toString();
return toDetectCodeLocation(detectSourcePath, extraction, evaluation.getDetectableEnvironment().getDirectory(), name);
}
return detectCodeLocations;
}
use of com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocation in project synopsys-detect by blackducksoftware.
the class UniversalStepRunner method generateBdio.
public BdioResult generateBdio(UniversalToolsResult universalToolsResult, NameVersion projectNameVersion) throws OperationException {
ProjectDependencyGraph aggregateDependencyGraph = operationFactory.aggregateSubProject(projectNameVersion, universalToolsResult.getDetectCodeLocations());
AggregateCodeLocation aggregateCodeLocation = operationFactory.createAggregateCodeLocation(aggregateDependencyGraph, projectNameVersion);
operationFactory.createAggregateBdio2File(aggregateCodeLocation);
List<UploadTarget> uploadTargets = new ArrayList<>();
Map<DetectCodeLocation, String> codeLocationNamesResult = new HashMap<>();
universalToolsResult.getDetectCodeLocations().forEach(cl -> codeLocationNamesResult.put(cl, aggregateCodeLocation.getCodeLocationName()));
// TODO: This doesn't seem right, it should just be the aggregate CL name right?
uploadTargets.add(UploadTarget.createDefault(projectNameVersion, aggregateCodeLocation.getCodeLocationName(), aggregateCodeLocation.getAggregateFile()));
return new BdioResult(uploadTargets, new DetectCodeLocationNamesResult(codeLocationNamesResult));
}
use of com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocation in project synopsys-detect by blackducksoftware.
the class FullAggregateGraphCreator method aggregateCodeLocations.
public ProjectDependencyGraph aggregateCodeLocations(File sourcePath, NameVersion projectNameVersion, List<DetectCodeLocation> codeLocations) {
ExternalId projectExternalId = ExternalId.FACTORY.createNameVersionExternalId(DETECT_FORGE, projectNameVersion.getName(), projectNameVersion.getVersion());
ProjectDependency projectDependency = new ProjectDependency(projectExternalId);
ProjectDependencyGraph aggregateDependencyGraph = new ProjectDependencyGraph(projectDependency);
for (DetectCodeLocation detectCodeLocation : codeLocations) {
Dependency codeLocationDependency = createAggregateNode(sourcePath, detectCodeLocation);
aggregateDependencyGraph.addDirectDependency(codeLocationDependency);
DependencyGraphUtil.copyDirectDependenciesToParent(aggregateDependencyGraph, codeLocationDependency, detectCodeLocation.getDependencyGraph());
}
return aggregateDependencyGraph;
}
use of com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocation in project synopsys-detect by blackducksoftware.
the class BdioAggregationTest method readInputCodeLocations.
@NotNull
private static List<DetectCodeLocation> readInputCodeLocations(List<String> inputBdioFilenames, File sourceDir) throws IOException {
File inputBdioDir = new File("src/test/resources/workflow/bdio/aggregation/input");
List<DetectCodeLocation> inputCodelocations = new LinkedList<>();
for (String inputBdioFilename : inputBdioFilenames) {
File bdioFile = new File(inputBdioDir, inputBdioFilename);
SimpleBdioDocument simpleBdioDocument;
try (InputStream bdioInputStream = new FileInputStream(bdioFile);
BdioReader bdioReader = new BdioReader(gson, bdioInputStream)) {
simpleBdioDocument = bdioReader.readSimpleBdioDocument();
}
ExternalId externalId = simpleBdioDocument.getProject().bdioExternalIdentifier.externalIdMetaData;
ProjectDependency projectDependency = new ProjectDependency(externalId);
DependencyGraph dependencyGraph = bdioTransformer.transformToDependencyGraph(projectDependency, simpleBdioDocument.getProject(), simpleBdioDocument.getComponents());
DetectCodeLocation detectCodeLocation = DetectCodeLocation.forCreator(dependencyGraph, sourceDir, externalId, "testcreator");
inputCodelocations.add(detectCodeLocation);
}
return inputCodelocations;
}
Aggregations