use of com.puppycrawl.tools.checkstyle.ThreadModeSettings in project checkstyle by checkstyle.
the class CheckstyleAntTask method createRootModule.
/**
* Creates new instance of the root module.
*
* @return new instance of the root module
* @throws BuildException if the root module could not be created.
*/
private RootModule createRootModule() {
final RootModule rootModule;
try {
final Properties props = createOverridingProperties();
final ThreadModeSettings threadModeSettings = ThreadModeSettings.SINGLE_THREAD_MODE_INSTANCE;
final ConfigurationLoader.IgnoredModulesOptions ignoredModulesOptions;
if (executeIgnoredModules) {
ignoredModulesOptions = ConfigurationLoader.IgnoredModulesOptions.EXECUTE;
} else {
ignoredModulesOptions = ConfigurationLoader.IgnoredModulesOptions.OMIT;
}
final Configuration configuration = ConfigurationLoader.loadConfiguration(config, new PropertiesExpander(props), ignoredModulesOptions, threadModeSettings);
final ClassLoader moduleClassLoader = Checker.class.getClassLoader();
final ModuleFactory factory = new PackageObjectFactory(Checker.class.getPackage().getName() + ".", moduleClassLoader);
rootModule = (RootModule) factory.createModule(configuration.getName());
rootModule.setModuleClassLoader(moduleClassLoader);
rootModule.configure(configuration);
} catch (final CheckstyleException ex) {
throw new BuildException(String.format(Locale.ROOT, "Unable to create Root Module: " + "config {%s}, classpath {%s}.", config, classpath), ex);
}
return rootModule;
}
Aggregations