Bug 50743 - Cache results to speed up Checkstyle #build
Summary: Cache results to speed up Checkstyle #build
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Packaging (show other bugs)
Version: trunk
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-09 05:43 UTC by oliver
Modified: 2011-02-18 11:53 UTC (History)
0 users



Attachments
Patch to enable caching (2.39 KB, application/octet-stream)
2011-02-09 05:43 UTC, oliver
Details

Note You need to log in before you can comment on or make changes to this bug.
Description oliver 2011-02-09 05:43:49 UTC
Created attachment 26627 [details]
Patch to enable caching

Checkstyle supports caching files that have successfully passed with no errors, so that these files are not processed again on subsequent invocations of Checkstyle until the files are modified again. As the output below shows, this speeds up the Checkstyle from 51 seconds to 15 seconds.

The attached patch, based on trunk, adds support for caching Checkstyle results. The cache files are stored in the ${tomcat.output} directory, so are removed whenever an "ant clean" is performed.

You could get more sophisticated and store the cache files outside of the ${tomcat.output} directory to save history across "ant clean" invocations. In this case, you then need to make the build logic smarter to invalidate the cache files if any of the Checkstyle configuration files change. Let me know if you are interested in a patch to do this.

=======================================================
oliver@oliver-laptop tomcat-trunk]$ ant -q validate
     [echo] Testing  for /tmp/tomcat/checkstyle-5.1/checkstyle-all-5.1.jar
[checkstyle] /home/oliver/play/tomcat-trunk/java/org/apache/catalina/tribes/group/ExtendedRpcCallback.java:21:8: Unused import - org.apache.catalina.tribes.ErrorHandler.

BUILD FAILED
/home/oliver/play/tomcat-trunk/build.xml:430: Got 1 errors and 0 warnings.

Total time: 55 seconds
[oliver@oliver-laptop tomcat-trunk]$ ant -q validate
     [echo] Testing  for /tmp/tomcat/checkstyle-5.1/checkstyle-all-5.1.jar
[checkstyle] /home/oliver/play/tomcat-trunk/java/org/apache/catalina/tribes/group/ExtendedRpcCallback.java:21:8: Unused import - org.apache.catalina.tribes.ErrorHandler.

BUILD FAILED
/home/oliver/play/tomcat-trunk/build.xml:430: Got 1 errors and 0 warnings.

Total time: 15 seconds
Comment 1 Mark Thomas 2011-02-18 11:53:52 UTC
Thanks for the patch. I applied a slightly modified version to 7.0.x which will ship with 7.0.9 onwards.

I'm happy with a clean clearing out the cache - I think that makes sense.