use of com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocationNamesResult in project synopsys-detect by blackducksoftware.
the class UniversalStepRunner method generateAggregateBdio.
private BdioResult generateAggregateBdio(AggregateDecision aggregateDecision, UniversalToolsResult universalToolsResult, NameVersion projectNameVersion, String aggregateName) throws OperationException, DetectUserFriendlyException {
DependencyGraph aggregateDependencyGraph;
if (aggregateDecision.getAggregateMode() == AggregateMode.DIRECT) {
aggregateDependencyGraph = operationFactory.aggregateDirect(universalToolsResult.getDetectCodeLocations());
} else if (aggregateDecision.getAggregateMode() == AggregateMode.TRANSITIVE) {
aggregateDependencyGraph = operationFactory.aggregateTransitive(universalToolsResult.getDetectCodeLocations());
} else if (aggregateDecision.getAggregateMode() == AggregateMode.SUBPROJECT) {
aggregateDependencyGraph = operationFactory.aggregateSubProject(universalToolsResult.getDetectCodeLocations());
} else {
throw new DetectUserFriendlyException(String.format("The %s property was set to an unsupported aggregation mode, will not aggregate at this time.", DetectProperties.DETECT_BOM_AGGREGATE_REMEDIATION_MODE.getKey()), ExitCodeType.FAILURE_GENERAL_ERROR);
}
boolean isBdio2 = operationFactory.calculateBdioOptions().isBdio2Enabled();
String aggregateExtension = isBdio2 ? ".bdio" : ".jsonld";
AggregateCodeLocation aggregateCodeLocation = operationFactory.createAggregateCodeLocation(aggregateDependencyGraph, projectNameVersion, aggregateName, aggregateExtension);
if (isBdio2) {
operationFactory.createAggregateBdio2File(aggregateCodeLocation);
} else {
operationFactory.createAggregateBdio1File(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?
if (aggregateCodeLocation.getAggregateDependencyGraph().getRootDependencies().size() > 0 || aggregateDecision.shouldUploadEmptyAggregate()) {
uploadTargets.add(UploadTarget.createDefault(projectNameVersion, aggregateCodeLocation.getCodeLocationName(), aggregateCodeLocation.getAggregateFile()));
} else {
logger.warn("The aggregate contained no dependencies, will not upload aggregate at this time.");
}
return new BdioResult(uploadTargets, new DetectCodeLocationNamesResult(codeLocationNamesResult), isBdio2);
}
use of com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocationNamesResult in project synopsys-detect by blackducksoftware.
the class UniversalStepRunner method generateStandardBdio.
private BdioResult generateStandardBdio(UniversalToolsResult universalToolsResult, NameVersion projectNameVersion) throws OperationException {
logger.debug("Creating BDIO code locations.");
BdioCodeLocationResult codeLocationResult = operationFactory.createBdioCodeLocationsFromDetectCodeLocations(universalToolsResult.getDetectCodeLocations(), projectNameVersion);
DetectCodeLocationNamesResult namesResult = new DetectCodeLocationNamesResult(codeLocationResult.getCodeLocationNames());
logger.debug("Creating BDIO files from code locations.");
if (operationFactory.calculateBdioOptions().isBdio2Enabled()) {
return new BdioResult(operationFactory.createBdio2Files(codeLocationResult, projectNameVersion), namesResult, true);
} else {
return new BdioResult(operationFactory.createBdio1Files(codeLocationResult, projectNameVersion), namesResult, false);
}
}
use of com.synopsys.integration.detect.workflow.codelocation.DetectCodeLocationNamesResult 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));
}
Aggregations