ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Roebuck <stuart.roeb...@adolos.co.uk>
Subject [PATCH] JavaStyle Optional Task
Date Mon, 22 Jan 2001 16:28:47 GMT
Here's an optional Java source code reformatting task based around Chris Seguin's PrettyPrinter
and JRefactory code.

The task is currently about as simple as it can get, I'm posting it here on the basis that
it works, and other people may have more time than I have to make it better!

Currently it can be used in one of only two ways:

	<javastyle file="src/SourceFile.java" />

or:

	<javastyle>
		<fileset dir="src">
			<include name="**/*.java" />
		</fileset>
	</javastyle>

In-other-words, it either takes a single file attribute or standard filesets (with all their
options and variations).

The code reformatter then reformats the original file.  It does not currently have any option
for saving the result in another location.

All the formatting preferences are stored in the same .JRefactory/ directory of preference
files as the original PrettyPrinter code uses.  If no preferences already exist, these will
be generated the first time the task is used.  Clearly, it would be better in the future if
all these preferences could be set as attributes to this task.

I enclose the JavaStyle.jar file zipped to this email.  I would include the relevant patches
to the build, and taskdefs files, but the jakarta-ant CVS seems to be down at the moment.

Finally, it all depends on having the JRefactory library file included in your ant build.
 This can be downloaded from: <http://users.snip.net/~aseguin/csrefactory.html>.

Hope someone finds this useful.  It would be great to see this streamlined into something
that could be used painlessly.  Currently the reformatting has its limitations, but is nevertheless
pretty good.

Regards,

Stuart.


Mime
View raw message