final String includes = line.getOptionValue(includeOpt.getLongOpt());
final String excludes = line.getOptionValue(excludeOpt.getLongOpt());
final File outputDir = new File(line.getOptionValue(outputDirOpt.getLongOpt()));
final CoverageGenerator gen = CoverageGeneratorFactory.newInstance(baseDir, outputDir);
final Config config = gen.getConfig();
config.setIncludes(includes);
config.setExcludes(excludes);
if (line.hasOption(outputInstrumentedFilesOpt.getLongOpt())) {
config.setOutputInstrumentedFiles(true);
}
config.setNoInstrumentPatterns(line.getOptionValues(noInstrumentPatternOpt.getLongOpt()));
config.setSourcesToPreload(line.getOptionValue(sourcesToPreloadOpt.getLongOpt()));
config.setOutputStrategy(line.getOptionValue(outputStrategyOpt.getLongOpt()));
final String threadCount = line.getOptionValue(threadCountOpt.getLongOpt());
if (threadCount != null) {
try {
config.setThreadCount(Integer.parseInt(threadCount));
} catch (final Exception e) {
System.err.println("Invalid thread count");
printHelpAndExit(options);
}
}
if (line.hasOption(includeInlineScriptsOpt.getLongOpt())) {
config.setIncludeInlineScripts(true);
}
final String backgroundJavaScriptTimeout = line.getOptionValue(backgroundJavaScriptTimeoutOpt.getLongOpt());
if (backgroundJavaScriptTimeout != null) {
try {
config.setBackgroundJavaScriptTimeout(Long.valueOf(backgroundJavaScriptTimeout));
} catch (final Exception e) {
System.err.println("Invalid timeout");
printHelpAndExit(options);
}
}
config.setBrowserVersion(line.getOptionValue(browserVersionOpt.getLongOpt()));
config.setReportFormats(line.getOptionValue(reportFormatsOpt.getLongOpt()));
config.setSortBy(line.getOptionValue(sortByOpt.getLongOpt()));
config.setOrder(line.getOptionValue(orderOpt.getLongOpt()));
logger.debug("Configured the coverage generator, running");
gen.instrumentAndGenerateReports();
} catch (final MissingOptionException e) {