public bool Execute(string[] args, AnalysisConfig config, ITeamBuildSettings settings) { if (args == null) { throw new ArgumentNullException(nameof(args)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } logger.SuspendOutput(); targetUninstaller.UninstallTargets(); if (!ArgumentProcessor.TryProcessArgs(args, logger, out IAnalysisPropertyProvider provider)) { logger.ResumeOutput(); // logging already done return(false); } logger.Verbosity = VerbosityCalculator.ComputeVerbosity(config.GetAnalysisSettings(true), logger); logger.ResumeOutput(); LogStartupSettings(config, settings); if (!CheckCredentialsInCommandLineArgs(config, provider) || !CheckEnvironmentConsistency(config, settings)) { // logging already done return(false); } var propertyResult = GenerateAndValidatePropertiesFile(config); if (propertyResult.FullPropertiesFilePath != null) { #if NET46 ProcessCoverageReport(config, Path.Combine(config.SonarConfigDir, FileConstants.ConfigFileName), propertyResult.FullPropertiesFilePath); #endif bool result = false; if (propertyResult.RanToCompletion) { result = InvokeSonarScanner(provider, config, propertyResult.FullPropertiesFilePath); } #if NET46 if (settings.BuildEnvironment == BuildEnvironment.LegacyTeamBuild) { ProcessSummaryReportBuilder(config, result, Path.Combine(config.SonarConfigDir, FileConstants.ConfigFileName), propertyResult.FullPropertiesFilePath); } #endif return(result); } return(false); }
public bool Execute(string[] args, AnalysisConfig config, ITeamBuildSettings settings) { if (args == null) { throw new ArgumentNullException(nameof(args)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } targetUninstaller.UninstallTargets(); logger.SuspendOutput(); if (!ArgumentProcessor.TryProcessArgs(args, logger, out IAnalysisPropertyProvider provider)) { logger.ResumeOutput(); // logging already done return(false); } logger.Verbosity = VerbosityCalculator.ComputeVerbosity(config.GetAnalysisSettings(true), logger); logger.ResumeOutput(); LogStartupSettings(config, settings); if (!CheckCredentialsInCommandLineArgs(config, provider) || !CheckEnvironmentConsistency(config, settings)) { // logging already done return(false); } // if initialization fails a warning will have been logged at the source of the failure var initialised = codeCoverageProcessor.Initialise(config, settings); if (initialised && !codeCoverageProcessor.ProcessCoverageReports()) { // if processing fails, stop the workflow return(false); } var result = InvokeSonarScanner(provider, config); reportBuilder.GenerateReports(settings, config, result); return(result.RanToCompletion); }