use of com.synopsys.integration.detect.lifecycle.run.data.BlackDuckRunData in project synopsys-detect by blackducksoftware.
the class ProductBoot method boot.
public ProductRunData boot(BlackDuckDecision blackDuckDecision, DetectToolFilter detectToolFilter) throws DetectUserFriendlyException {
if (!blackDuckDecision.shouldRun()) {
throw new DetectUserFriendlyException("Your environment was not sufficiently configured to run Black Duck. See online help at: https://detect.synopsys.com/doc/", ExitCodeType.FAILURE_CONFIGURATION);
}
logger.debug("Detect product boot start.");
BlackDuckRunData blackDuckRunData = getBlackDuckRunData(blackDuckDecision, productBootFactory, blackDuckConnectivityChecker, productBootOptions, analyticsConfigurationService);
if (productBootOptions.isTestConnections()) {
logger.debug(String.format("%s is set to 'true' so Detect will not run.", DetectProperties.DETECT_TEST_CONNECTION.getName()));
return null;
}
logger.debug("Detect product boot completed.");
return new ProductRunData(blackDuckRunData, detectToolFilter);
}
use of com.synopsys.integration.detect.lifecycle.run.data.BlackDuckRunData in project synopsys-detect by blackducksoftware.
the class DetectRun method run.
public void run(BootSingletons bootSingletons) {
Optional<OperationSystem> operationSystem = Optional.empty();
try {
SingletonFactory singletonFactory = new SingletonFactory(bootSingletons);
EventSingletons eventSingletons = singletonFactory.createEventSingletons();
UtilitySingletons utilitySingletons = singletonFactory.createUtilitySingletons(eventSingletons);
operationSystem = Optional.of(utilitySingletons.getOperationSystem());
// TODO: Remove run data from boot singletons
ProductRunData productRunData = bootSingletons.getProductRunData();
OperationFactory operationFactory = createOperationFactory(bootSingletons, utilitySingletons, eventSingletons);
StepHelper stepHelper = new StepHelper(utilitySingletons.getOperationSystem(), utilitySingletons.getOperationWrapper(), productRunData.getDetectToolFilter());
// Product independent tools
UniversalStepRunner stepRunner = new UniversalStepRunner(operationFactory, stepHelper);
UniversalToolsResult universalToolsResult = stepRunner.runUniversalTools();
// combine: processProjectInformation() -> ProjectResult (nameversion, bdio)
NameVersion nameVersion = stepRunner.determineProjectInformation(universalToolsResult);
operationFactory.publishProjectNameVersionChosen(nameVersion);
BdioResult bdio = stepRunner.generateBdio(universalToolsResult, nameVersion);
if (productRunData.shouldUseBlackDuckProduct()) {
BlackDuckRunData blackDuckRunData = productRunData.getBlackDuckRunData();
if (blackDuckRunData.isRapid() && blackDuckRunData.isOnline()) {
RapidModeStepRunner rapidModeSteps = new RapidModeStepRunner(operationFactory);
rapidModeSteps.runOnline(blackDuckRunData, nameVersion, bdio);
} else if (blackDuckRunData.isRapid()) {
logger.info("Rapid Scan is offline, nothing to do.");
} else if (blackDuckRunData.isOnline()) {
IntelligentModeStepRunner intelligentModeSteps = new IntelligentModeStepRunner(operationFactory, stepHelper);
intelligentModeSteps.runOnline(blackDuckRunData, bdio, nameVersion, productRunData.getDetectToolFilter(), universalToolsResult.getDockerTargetData());
} else {
IntelligentModeStepRunner intelligentModeSteps = new IntelligentModeStepRunner(operationFactory, stepHelper);
intelligentModeSteps.runOffline(nameVersion, universalToolsResult.getDockerTargetData());
}
}
} catch (Exception e) {
logger.error(ReportConstants.RUN_SEPARATOR);
logger.error("Detect run failed.");
exceptionUtility.logException(e);
logger.debug("An exception was thrown during the detect run.", e);
logger.error(ReportConstants.RUN_SEPARATOR);
exitCodeManager.requestExitCode(e);
checkForInterruptedException(e);
} finally {
operationSystem.ifPresent(OperationSystem::publishOperations);
}
}
Aggregations