You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ninju Bohra <ni...@yahoo.com> on 2005/02/15 18:45:14 UTC
When do I need to explicitly convert the ${...}'s
Hey Guys (and gals),
I was writing my own task and need recieve a date format from the user.
Wanting to make the task as flexible as possible, I want to be able to support values that contain ${...} text (that needs to be expanded) as well as verbatim text.
The question is that it appears that the ${...} are already replaced for me on basic attribute sets...
For example
<tstamp/>
<dateFormatter inputDate="${TODAY}" dateFormat="MMMM dd yyyy">
In my new task (dateFormatter) the inputDate attribute contains the value of the TODAY property.
I am not saying this bad, I was just surprised that it was already done for me...what the value of the Project.replaceProperties(...) method then?
---------------------------------
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'
Re: When do I need to explicitly convert the ${...}'s
Posted by Peter Reilly <pe...@apache.org>.
Ninju Bohra wrote:
>I am not saying this bad, I was just surprised that it was already done for me...what the value of the Project.replaceProperties(...) method then?
>
>
>
The project.replaceProperties() is used by RuntimeConfigurable to
replace the properties
in a task's attributes just before the task is called with the attributes.
Note that this only happens for attributes, for embedded text (cdata
etc), the replaceProperties method is not
called by the ant runtime, it is up the the individual task to call it
if required - most tasks do, (<echo/> for example has this
code:
public void addText(String msg) {
message += getProject().replaceProperties(msg);
}
) and some do not - for example <script>.
Peter
>
>---------------------------------
>Do you Yahoo!?
> Yahoo! Search presents - Jib Jab's 'Second Term'
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: When do I need to explicitly convert the ${...}'s
Posted by Yves Martin <yv...@elca.ch>.
Ninju Bohra <ni...@yahoo.com> writes:
> I was writing my own task and need recieve a date format from the user.
> Wanting to make the task as flexible as possible, I want to be able to
> support values that contain ${...} text (that needs to be expanded) as
> well as verbatim text.
>
> The question is that it appears that the ${...} are already replaced for
> me on basic attribute sets...
> For example
> <tstamp/>
> <dateFormatter inputDate="${TODAY}" dateFormat="MMMM dd yyyy">
>
> In my new task (dateFormatter) the inputDate attribute contains the
> value of the TODAY property.
>
> I am not saying this bad, I was just surprised that it was already done
> for me...what the value of the Project.replaceProperties(...) method
> then?
I think the way Ant works is the most comfortable for most of Ant task
developpers.
In your case (if existing tstamp date formatter does not suit your needs), you
have to work around the property replacement. You can define your API to ask a
property like inputDate="TODAY" and do the job considering inputDate is a
property name.
Regards,
--
Yves Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: When do I need to explicitly convert the ${...}'s
Posted by Jeffrey E Care <ca...@us.ibm.com>.
This is orthogonal, but <tstamp> can already accept a fomatter.
--
Jeffrey E. Care (carej@us.ibm.com)
WebSphere Build SWAT Team Lead
WebSphere Build Tooling Lead (Project Mantis)
https://w3.opensource.ibm.com/projects/mantis
Ninju Bohra <ni...@yahoo.com> wrote on 02/15/2005 12:45:14 PM:
> Hey Guys (and gals),
>
> I was writing my own task and need recieve a date format from the user.
> Wanting to make the task as flexible as possible, I want to be able
> to support values that contain ${...} text (that needs to be
> expanded) as well as verbatim text.
>
> The question is that it appears that the ${...} are already replaced
> for me on basic attribute sets...
> For example
> <tstamp/>
> <dateFormatter inputDate="${TODAY}" dateFormat="MMMM dd yyyy">
>
> In my new task (dateFormatter) the inputDate attribute contains the
> value of the TODAY property.
>
> I am not saying this bad, I was just surprised that it was already
> done for me...what the value of the Project.replaceProperties(...)
> method then?
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Search presents - Jib Jab's 'Second Term'