Ant: accept path in addition to fileset option #3312

Closed
romani opened this Issue Jun 26, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@romani
Member

romani commented Jun 26, 2016

Created: 2009-03-30
Creator: Oliver Burn

We just started using checkstyle in our Java 6 codebase with Ant. It seems that Ant is going through a mild revolution in terms of Resource Collections in its data types, which is a good thing.

I bring this up because the checkstyle ant task only takes a single file or a fileset as input. The problem is that I have my source files in several directories that are defined as a path, a sourcepath that is used with many tasks including javac, javadoc, etc. Unfortunately Ant doesn’t make it easy to convert from a path to a fileset(http://stackoverflow.com/a/1700641/1015848), and the ant-contrib task of pathtofileset doesn’t actually make a fileset of the files in the path, just of the paths themselves. If I do this and pass the new fileset to the checkstyle ant task it doesn’t find any java files.

When I discussed this on the ant mailing list, it was suggested that checkstyle support paths as well as filesets for specifying source files. http://mail-archives.apache.org/mod_mbox/ant-user/200903.mbox/%3c49CBFEA9.4040109@gmx.de%3e

I had a quick look at doing this in the checkstyle task. With the assumption that a provided path specifies a number of root directories that are expanded into source trees, doesn’t seem too difficult. To handle all resource types appears to be quite a bit more effort at first glance but still not complex.

Read:
"fileset" type - https://ant.apache.org/manual/tutorial-tasks-filesets-properties.html#filesets , java type "FileSet"
"path" type - https://ant.apache.org/manual/tutorial-tasks-filesets-properties.html#path, java type "Path"

Right now we have public void addFileset(FileSet fileSet) { - https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java#L158
it is required to create new property public void addPath(Path path) {

@romani romani added the approved label Jun 26, 2016

@rnveach rnveach added the medium label Mar 2, 2017

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Mar 8, 2017

Member

Pre-assigned to kuchevad

Member

romani commented Mar 8, 2017

Pre-assigned to kuchevad

@soon

This comment has been minimized.

Show comment
Hide comment
@soon

soon Mar 8, 2017

Contributor

I am on it

Contributor

soon commented Mar 8, 2017

I am on it

soon added a commit to soon/checkstyle that referenced this issue Apr 3, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 3, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 3, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 5, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 5, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 5, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 5, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 15, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 15, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 15, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 18, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 18, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 18, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 18, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 19, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 19, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 19, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 19, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 22, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 22, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 24, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 24, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 24, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 25, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 26, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 26, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 27, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 27, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 29, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 29, 2017

soon added a commit to soon/checkstyle that referenced this issue Apr 29, 2017

romani added a commit that referenced this issue Apr 29, 2017

@romani romani added the new feature label Apr 29, 2017

@romani romani added this to the 7.7 milestone Apr 29, 2017

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Apr 29, 2017

Member

Fix is merged

Member

romani commented Apr 29, 2017

Fix is merged

@romani romani closed this Apr 29, 2017

@romani romani changed the title from Ant: accept sourcepath in addition to fileset option to Ant: accept path in addition to fileset option Apr 29, 2017

timurt added a commit to timurt/checkstyle that referenced this issue May 6, 2017

timurt added a commit to timurt/checkstyle that referenced this issue May 6, 2017

timurt added a commit to timurt/checkstyle that referenced this issue May 6, 2017

timurt added a commit to timurt/checkstyle that referenced this issue May 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment