Excluding files tool-by-tool?

0 views
Skip to first unread message

AndyK

unread,
Jun 16, 2009, 11:37:11 AM6/16/09
to glean-code-users
I am looking into glean as a way of pulling together the various tools
we use to analyze code. For a tool like checkstyle, we exclude
generated code, while we do analyze generated code with findbugs.
Without glean, we configure this in the tool's ant task using a
fileset with tool-specific exclusions. How would I accomplish the same
thing with glean? Do I need to edit the tool's build.xml and add a new
property? Or is there a better way?

thx

John Brugge

unread,
Jun 16, 2009, 2:14:49 PM6/16/09
to glean-co...@googlegroups.com
Andy,

Unfortunately, Glean doesn't support general exclusions that can apply to all tools. There are a few tools, though that do support exclusions with hooks that Glean takes advantage of:
* findbugs: use the property "findbugs.excludes.file" to point to a Findbugs-style exclusion file (a sample is in ${glean.home}/tool/findbugs/findbugs-default-filter.xml).
* emma and cobertura each support exclusion filters - see the tools page (http://jbrugge.com/glean/tools.html) for the property descriptions of these

For Checkstyle, though, it looks like the only way to do it, if your generated source is not in a separate tree from your other source, is to edit the build.xml for the tool.

Since Glean configuration is all property-based, another way it could be done is by defining a property that would point to an exludesfile (http://ant.apache.org/manual/CoreTypes/fileset.html), and have the <fileset> definition in the tools' build.xml refer to that (the default being an empty file, perhaps?). So you would might create a file, ${project.root}/config/generated-file-excludes.txt, for instance, that had this line in it:

**/generated/*.java

The checkstyle's build.xml could have:
<fileset dir="${src.dir}" includes="**/*.java">
    <excludesfile="${project.exclude.filter}" />
</fileset>

You would then just add a property definition to your (project).feedback.properties file:
project.exclude.filter=${project.root}/config/generated-file-excludes.txt

The should work for any of the other tools that deal with filesets alone to define their set of input files. If I find the time, perhaps I'll add that in :-)

Hope that helps,
John

AndyK

unread,
Jun 16, 2009, 3:24:19 PM6/16/09
to glean-code-users
Thanks - that's along the lines of what I was thinking.
I've always been partial to patternsets over additional files to keep
track of.
So, I defined <patternset refid="checkstyle.exclude"/> where you can
define a project-specific patternset for exclusions.

John Brugge

unread,
Jun 16, 2009, 4:56:15 PM6/16/09
to glean-co...@googlegroups.com
Sure, even better. I would agree that proliferating files will get out of hand.

John
Reply all
Reply to author
Forward
0 new messages