You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Florian G. Haas" <f....@gmx.net> on 2003/11/08 17:49:07 UTC

[SUBMIT] ProjectHelp - refactored project help output

-----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....@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-----

Re: [SUBMIT] ProjectHelp - refactored project help output

Posted by "Florian G. Haas" <f....@gmx.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again.

On Sunday 09 November 2003 01:25, Steve Loughran wrote:
| > 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.
|
| dont worry, you followed the process to the letter; I am very impressed.
|   Add it as a bugrep and keep reminding people if nobody acts on it.

I take this as an open invitation from Steve to be a nuisance. :-) OK, here's 
the reminder. Have any of you had a chance to test this submitted task? If 
yes, I'd be grateful for any additional input on it, in case I forgot about a 
needed feature or did something in a not-so-elegant manner, requiring a 
touch-up. 

One thing that did cross my mind in the meantime: if accepted, perhaps it 
would be a good idea to provide the alias "usage" for this task, the way 
"style" is an alias for "xslt". But that's just a minimal detail, of course.

| It
| sounds pretty good, and I will try and patch my version to see how well
| it works.

Mind telling me whether it did indeed work well, Steve?

Regards,
Florian

- -- 
Florian G. Haas <f....@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/so8vgW2VC0bQC+MRAkvUAKCUA2GxvebZpClF73/249YNV5/AXQCgw5qF
5+xUd8h18cpDWjAQrqqz2u8=
=DrLa
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: [SUBMIT] ProjectHelp - refactored project help output

Posted by Steve Loughran <st...@iseran.com>.
> 
> 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.
> 
> 

dont worry, you followed the process to the letter; I am very impressed. 
  Add it as a bugrep and keep reminding people if nobody acts on it. It 
sounds pretty good, and I will try and patch my version to see how well 
it works.

-steve


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org