From 44ad8ceedb46e06938ec7962f168835756db31c9 Mon Sep 17 00:00:00 2001 From: Rick Giles Date: Thu, 19 Dec 2002 23:27:52 +0000 Subject: [PATCH] added attribute "packageNamesFile" to checkstyle task element --- .../tools/checkstyle/CheckStyleTask.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java index 80cb472a9..6ae4d3fa2 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/CheckStyleTask.java @@ -64,6 +64,9 @@ public class CheckStyleTask /** config file containing configuration */ private File mConfigFile; + /** contains package names */ + private File mPackageNamesFile = null; + /** whether to fail build on violations */ private boolean mFailOnViolation = true; @@ -160,6 +163,12 @@ public class CheckStyleTask mConfigFile = aFile; } + /** @param aFile the package names file to use */ + public void setPackageNamesFile(File aFile) + { + mPackageNamesFile = aFile; + } + //////////////////////////////////////////////////////////////////////////// // Setters for Checker configuration attributes //////////////////////////////////////////////////////////////////////////// @@ -212,6 +221,14 @@ public class CheckStyleTask context.add("classloader", loader); c = new Checker(); + + //load the set of package names + if (mPackageNamesFile != null) { + ModuleFactory moduleFactory = + PackageNamesLoader.loadModuleFactory( + mPackageNamesFile.getAbsolutePath()); + c.setModuleFactory(moduleFactory); + } c.contextualize(context); c.configure(config);