-----------------------------------------------------------------------------
| 205 | |
| 206 | //----------------------------------------------------------------------------- |
| 207 | int OpenCppCoverage::Run(int argc, |
| 208 | const char** argv, |
| 209 | std::wostream* emptyOptionsExplanation) const |
| 210 | { |
| 211 | auto warningManager = std::make_shared<Tools::WarningManager>(); |
| 212 | std::vector<std::unique_ptr<cov::IOptionParser>> optionParsers; |
| 213 | |
| 214 | Exporter::ExporterPluginManager exporterPluginManager{ |
| 215 | Exporter::PluginLoader<Plugin::IExportPlugin>{}, |
| 216 | GetPluginsExportFolder()}; |
| 217 | |
| 218 | auto exportPluginDescriptions = |
| 219 | exporterPluginManager.CreateExportPluginDescriptions(); |
| 220 | optionParsers.push_back(std::make_unique<cov::ExportOptionParser>( |
| 221 | std::move(exportPluginDescriptions))); |
| 222 | cov::OptionsParser optionsParser{warningManager, std::move(optionParsers)}; |
| 223 | |
| 224 | auto options = optionsParser.Parse(argc, argv, emptyOptionsExplanation); |
| 225 | auto status = FailureExitCode; |
| 226 | |
| 227 | if (options) |
| 228 | { |
| 229 | try |
| 230 | { |
| 231 | status = ::OpenCppCoverage::Run(*options, exporterPluginManager, warningManager); |
| 232 | } |
| 233 | catch (const std::exception& e) |
| 234 | { |
| 235 | LOG_ERROR << "Error: " << e.what(); |
| 236 | } |
| 237 | catch (...) |
| 238 | { |
| 239 | LOG_ERROR << "Unkown Error"; |
| 240 | } |
| 241 | |
| 242 | warningManager->DisplayWarnings(); |
| 243 | if (options->IsPlugingModeEnabled()) |
| 244 | { |
| 245 | std::cout << "Press any key to continue... "; |
| 246 | std::cin.get(); |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | return status; |
| 251 | } |
| 252 | } |
no test coverage detected