ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Florian G. Haas" <f.g.h...@gmx.net>
Subject [SUBMIT] ProjectHelp - refactored project help output
Date Sat, 08 Nov 2003 16:49:07 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all.

I hereby humbly submit a new task, refactoring the way Ant describes a project 
when invoked as "ant -projecthelp". The task also introduces the option of 
autogenerating a project description from inside a build file.

* Task class name: org.apache.tools.ant.taskdefs.ProjectHelp
* Test suite: org.apache.tools.ant.taskdefs.ProjectHelpTest
* Modified source code outside of task definition: org.apache.tools.ant.Main


Task description:

Intended as a replacement for the code in org.apache.tools.ant.Main
currently in charge of generating the project description. Task reads
project description, target names, target description, and default
target. Task groups defined targets by main target, sub targets and
internal targets, and orders them alphabetically by name within these
groups. Task attempts to format project description in such a way that
lines are nicely wrapped to fit into a defined line width (if set).

Patch includes modified org.apache.tools.ant.Main which uses the new
task. org.apache.tools.ant.Main invokes task using default settings,
which duplicates current behavior of "ant -projecthelp"


Rationale for this task:

* There is currently no way of autogenerating a project description from
within a target in a build file. Many users duplicate the information in
their target descriptions by using a target with lots of <echo> elements,
commonly named "usage" or similar. This redundancy is unnecessary and
error-prone.

* The job of generating a project description is currently done by
org.apache.tools.ant.Main, where it clutters up the code to a considerable
extent. Putting that functionality into the ProjectHelp task and then 
executing that task from Main reduces Main.java by 130 LOC.

* The method of ordering tasks in alphabetical order by name was a
candidate for an overhaul, as it was written in a JDK1.1-compatible manner. 
With the JDK1.1 compatibility requirement dropped, it can now be implemented 
more cleanly using the SortedSet interface, available since JDK1.2.


Completed testing:

Task has been successfully compiled and tested on JDKs 1.2.2_014, 1.3.1_03, 
1.4.0_01 and 1.4.2_01 on Linux.


Note:

This is my first submission to a list I've only been lurking on for a
little while. I have tried to follow the Task Design Guidelines as
best as I could, but I would greatly appreciate any hints from more
experienced developers if I failed to follow proper procedure.


Best regards,
Florian

- -- 
Florian G. Haas <f.g.haas@gmx.net> http://member.ycn.com/~fgh/en/

GnuPG key ID: 0x46D00BE3
Key fingerprint: 18B4 3E7B 191E F534 254A  1F7C 816D 950B 46D0 0BE3

My GnuPG key is available from the public PGP key server at
pgp.mit.edu (and various other key servers).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE/rR6JgW2VC0bQC+MRAhW1AKCN+kaMd4+4fPhRv55OXJ5kR4JeLwCghtWM
TO8Gc6NZKDE2t5wF+H1nIQQ=
=gN5o
-----END PGP SIGNATURE-----

Mime
View raw message