/// <summary> /// Locates the ProjectInfo.xml files and uses the information in them to generate /// a sonar-scanner properties file /// </summary> /// <returns>Information about each of the project info files that was processed, together with /// the full path to generated file. /// Note: the path to the generated file will be null if the file could not be generated.</returns> public ProjectInfoAnalysisResult GenerateFile() { var projectPropertiesPath = Path.Combine(analysisConfig.SonarOutputDir, ProjectPropertiesFileName); logger.LogDebug(Resources.MSG_GeneratingProjectProperties, projectPropertiesPath, SonarProduct.GetSonarProductToLog(analysisConfig.SonarQubeHostUrl)); var result = new ProjectInfoAnalysisResult(); var writer = new PropertiesWriter(analysisConfig, logger); var success = TryWriteProperties(writer, out IEnumerable <ProjectData> projects); if (success) { var contents = writer.Flush(); File.WriteAllText(projectPropertiesPath, contents, Encoding.ASCII); logger.LogDebug(Resources.DEBUG_DumpSonarProjectProperties, contents); result.FullPropertiesFilePath = projectPropertiesPath; } else { logger.LogInfo(Resources.MSG_PropertiesGenerationFailed); } result.Projects.AddRange(projects); return(result); }
public static void WriteSummaryReport(AnalysisConfig config, ProjectInfoAnalysisResult result, ILogger logger) { var builder = new ProjectInfoReportBuilder(config, result, logger); builder.Generate(); }