You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Raja Nagendra Kumar <Na...@tejasoft.com> on 2009/12/18 13:37:27 UTC

should ant 'id' value be a static string

Hi,

I am trying to set the path property id to be dynamic i.e id is
app.${module.id}.sp where module.id value should be taken the the final path
id should be app.tejasoft.sp.

However the echo says that path not found.

Is it expected that path id's or any ids to be always static.. Are I am
doing any thing wrong here..

<project>

<property name="module.id" value="tejasoft"/>

<path id="app.${module.id}.sp">
    <pathelement path="${src}"/>
    <pathelement location="c:/temp"/>
</path>

<path id="app.nag.sp">
    <pathelement path="${src}"/>
    <pathelement location="c:/temp"/>
</path>

<echo message="${toString:app.${module.id}.sp}"/>
<echo message="module.id defined one : ${toString:app.tejasoft.sp}"/>
<echo message="not referenced one : ${toString:app.nag.sp}"/>

</project>

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
-- 
View this message in context: http://old.nabble.com/should-ant-%27id%27-value-be-a-static-string-tp26842763p26842763.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: should ant 'id' value be a static string

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Also, if one uses id as ${foo}, I am not sure if there a way to refer this..
as in all other places using ${foo} would get resolved to a value. 

Another point, not sure, if Bugs discovered at very late stages can be
considered as BC in order to consider the fixes for the same.

Pl. see if this could be considered to be fixed. Due to global nature of all
the id's, i see immense power in making them dynamic.

Regards,
Nagendra
-- 
View this message in context: http://old.nabble.com/should-ant-%27id%27-value-be-a-static-string-tp26842763p26884053.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


Re: AW: AW: should ant 'id' value be a static string

Posted by Matt Benson <gu...@gmail.com>.
Well, theoretically if some user were using a ${foo} construct as an  
explicit id, then yes, that would break BC, but I would imagine such  
situations to be extremely rare and wouldn't have a problem with  
adding property expansion to the id attribute.

-Matt

On Dec 21, 2009, at 7:27 AM, <Ja...@rzf.fin-nrw.de> wrote:

>> As one kind of resolutions work and not other one.. for id's.
>> Jan pl. let me know why such design..
>
> Not sure, was before my time (2003) ;-)
> Changing that would on the other hand break backwards compatibility.
>
>
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


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


AW: AW: should ant 'id' value be a static string

Posted by Ja...@rzf.fin-nrw.de.
>As one kind of resolutions work and not other one.. for id's. 
>Jan pl. let me know why such design.. 

Not sure, was before my time (2003) ;-)
Changing that would on the other hand break backwards compatibility.


Jan

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


RE: AW: should ant 'id' value be a static string

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Yep.. this approach works..  Thank you tom for this tip.

As one kind of resolutions work and not other one.. for id's. Jan pl. let me
know why such design.. 


Below is the example..

<project>

<property name="module.id" value="tejasoft"/>

<macrodef name="ab">
<attribute name="prefix" default="${module.id}"/>
	<sequential>
<path id="app.@{prefix}.sp">
    <pathelement path="${src}"/>
    <pathelement location="c:/temp"/>
</path>

<path id="app.nag.sp">
    <pathelement path="${src}"/>
    <pathelement location="c:/temp"/>
</path>
<echo message="${toString:app.${module.id}.sp}"/>
<echo message="module.id defined one : ${toString:app.tejasoft.sp}"/>
<echo message="not referenced one : ${toString:app.nag.sp}"/>
</sequential>
</macrodef>
<ab/>
</project>

-- 
View this message in context: http://old.nabble.com/should-ant-%27id%27-value-be-a-static-string-tp26842763p26844870.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


RE: AW: should ant 'id' value be a static string

Posted by "Dalton, Tom" <td...@hp.com>.
Are macro attributes expanded within ids? If so you might be able to wrap your code with macros and pass the dynamic ids in as attributes to macro calls... Much like I have had to do with the double-dereferencing property issue...

Tom

-----Original Message-----
From: Raja Nagendra Kumar [mailto:Nagendra.Raja@tejasoft.com] 
Sent: 18 December 2009 14:48
To: user@ant.apache.org
Subject: Re: AW: should ant 'id' value be a static string


Nope.. that is surprising jan.. why such restriction..


I see the need for dynamic naming for id's,  this approach could reduce passing of few parameters to macros specially which depend on class path and source path used to compile the java classes etc.

Regards,
Nagendra
--
View this message in context: http://old.nabble.com/should-ant-%27id%27-value-be-a-static-string-tp26842763p26844518.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


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


Re: AW: should ant 'id' value be a static string

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Nope.. that is surprising jan.. why such restriction..


I see the need for dynamic naming for id's,  this approach could reduce
passing of few parameters to macros specially which depend on class path and
source path used to compile the java classes etc.

Regards,
Nagendra
-- 
View this message in context: http://old.nabble.com/should-ant-%27id%27-value-be-a-static-string-tp26842763p26844518.html
Sent from the Ant - Users mailing list archive at Nabble.com.


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


AW: should ant 'id' value be a static string

Posted by Ja...@rzf.fin-nrw.de.
You can write whatever you want as "id" value. 
But properties are not resolved, means the path in 
  <property name="foo" value="bar"/>
  <path id="${foo}"/>
has the id "${foo}" (with dollar and brackets) and not "bar".

In this sence - yes, IDs are static.


Jan
 

>-----Ursprüngliche Nachricht-----
>Von: Raja Nagendra Kumar [mailto:Nagendra.Raja@tejasoft.com] 
>Gesendet: Freitag, 18. Dezember 2009 13:37
>An: user@ant.apache.org
>Betreff: should ant 'id' value be a static string
>
>
>Hi,
>
>I am trying to set the path property id to be dynamic i.e id is
>app.${module.id}.sp where module.id value should be taken the 
>the final path
>id should be app.tejasoft.sp.
>
>However the echo says that path not found.
>
>Is it expected that path id's or any ids to be always static.. Are I am
>doing any thing wrong here..
>
><project>
>
><property name="module.id" value="tejasoft"/>
>
><path id="app.${module.id}.sp">
>    <pathelement path="${src}"/>
>    <pathelement location="c:/temp"/>
></path>
>
><path id="app.nag.sp">
>    <pathelement path="${src}"/>
>    <pathelement location="c:/temp"/>
></path>
>
><echo message="${toString:app.${module.id}.sp}"/>
><echo message="module.id defined one : ${toString:app.tejasoft.sp}"/>
><echo message="not referenced one : ${toString:app.nag.sp}"/>
>
></project>
>
>Regards,
>Raja Nagendra Kumar,
>C.T.O
>www.tejasoft.com
>-- 
>View this message in context: 
>http://old.nabble.com/should-ant-%27id%27-value-be-a-static-str
ing-tp26842763p26842763.html
>Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>

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