-------------------------------------------------------------------------
| 77 | |
| 78 | //------------------------------------------------------------------------- |
| 79 | void HtmlExporter::Export( |
| 80 | const Plugin::CoverageData& coverageData, |
| 81 | const std::filesystem::path& outputFolderPrefix) |
| 82 | { |
| 83 | HtmlFolderStructure htmlFolderStructure{templateFolder_}; |
| 84 | cov::CoverageRateComputer coverageRateComputer{ coverageData }; |
| 85 | |
| 86 | auto mainMessage = GetMainMessage(coverageData); |
| 87 | |
| 88 | auto projectDictionary = exporter_.CreateTemplateDictionary(coverageData.GetName(), mainMessage); |
| 89 | auto outputFolder = htmlFolderStructure.CreateCurrentRoot(outputFolderPrefix); |
| 90 | |
| 91 | exporter_.AddModuleSectionToDictionary( |
| 92 | coverageData.GetName(), |
| 93 | coverageRateComputer.GetCoverageRate(), |
| 94 | true, |
| 95 | nullptr, |
| 96 | *projectDictionary); |
| 97 | |
| 98 | for (const auto& module : coverageRateComputer.SortModulesByCoverageRate()) |
| 99 | { |
| 100 | const auto& moduleCoverageRate = coverageRateComputer.GetCoverageRate(*module); |
| 101 | |
| 102 | if (moduleCoverageRate.GetTotalLinesCount()) |
| 103 | { |
| 104 | const auto& modulePath = module->GetPath(); |
| 105 | auto moduleFilename = module->GetPath().filename(); |
| 106 | auto moduleTemplateDictionary = exporter_.CreateTemplateDictionary(moduleFilename.wstring(), L""); |
| 107 | |
| 108 | auto htmlModulePath = htmlFolderStructure.CreateCurrentModule(modulePath); |
| 109 | ExportFiles(coverageRateComputer, *module, htmlFolderStructure, *moduleTemplateDictionary); |
| 110 | |
| 111 | exporter_.GenerateModuleTemplate(*moduleTemplateDictionary, htmlModulePath.GetAbsolutePath()); |
| 112 | exporter_.AddModuleSectionToDictionary( |
| 113 | module->GetPath(), |
| 114 | moduleCoverageRate, |
| 115 | false, |
| 116 | &htmlModulePath.GetRelativeLinkPath(), |
| 117 | *projectDictionary); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | exporter_.GenerateProjectTemplate(*projectDictionary, outputFolder / L"index.html"); |
| 122 | Tools::ShowOutputMessage(L"Coverage generated in Folder ", outputFolder); |
| 123 | } |
| 124 | |
| 125 | //--------------------------------------------------------------------- |
| 126 | void HtmlExporter::ExportFiles( |
no test coverage detected