Bug 27722 - Project description contains target description
Summary: Project description contains target description
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.6.1
Hardware: Other other
: P3 enhancement with 2 votes (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-16 21:38 UTC by Dale Anson
Modified: 2012-04-27 15:31 UTC (History)
0 users



Attachments
diff for Description.java (681 bytes, patch)
2004-03-16 21:39 UTC, Dale Anson
Details | Diff
patch for Target.java (1.01 KB, patch)
2004-03-16 21:40 UTC, Dale Anson
Details | Diff
a better diff for Target, this one does not let -projecthelp show a description for the implicit target, as that is actually the description for the target. (1.07 KB, patch)
2004-03-16 22:00 UTC, Dale Anson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dale Anson 2004-03-16 21:38:56 UTC
A thread discussing this is has been on the ant user list for the past few days.
Suppose a target has a <description> child element. Then running 'ant
-projecthelp' will show that description as part of the project description, not
as part of the target description. Note that <description> is a valid child
element of target. I have two patches to fix this:

1. In org.apache.tools.ant.types.Description.java, it explicitly looks through
ALL targets for <description> elements and adds any text contained in those
elements to the project description. The patch limits this to the implicit
target only.

2. In org.apache.tools.ant.Target.java, the description can only be set as an
attribute. The patch appends any text contained in child <description> elements
to any text contained in the description attribute.
Comment 1 Dale Anson 2004-03-16 21:39:37 UTC
Created attachment 10819 [details]
diff for Description.java
Comment 2 Dale Anson 2004-03-16 21:40:03 UTC
Created attachment 10820 [details]
patch for Target.java
Comment 3 Dale Anson 2004-03-16 22:00:44 UTC
Created attachment 10821 [details]
a better diff for Target, this one does not let -projecthelp show a description for the implicit target, as that is actually the description for the target.
Comment 4 Dale Anson 2004-03-16 22:06:16 UTC
That should say,
"a better diff for Target, this one does not let -projecthelp show a description
for the implicit target, as that is actually the description for the Project."

It would also be good to be able to show the project descriptions for projects
imported by the <import> task.
Comment 5 Matt Benson 2004-03-17 00:06:01 UTC
Did you say that right?  What does -projecthelp show then?
Comment 6 Dale Anson 2004-03-17 16:20:08 UTC
The top-level <description> element is actually inside an "invisible" target,
referred to in the API docs as the "implicit target". So the <description>
element in the implicit target is in fact the <description> element for the
project. The last patch stops 'ant -projecthelp' from displaying the implicit
target, which makes sense as it is invisible.
Comment 7 Matt Benson 2004-03-17 16:24:07 UTC
Okay, I was just making sure I understood what you were doing--the sensible 
thing, sounds like.  :)
Comment 8 Adam Hardy 2004-03-20 14:49:43 UTC
If people are already implementing the current functionality deliberately to get
description text into the project level description, perhaps an attribute like
targetOnly="true" would be in order. 

Also desirable IMHO if anyone is hacking away at this right now, would be to
output the target name as a prefix to the description when it appears at project
level. 

But otherwise, current behaviour is a bit weird.