Hi Jarek,
I think we should add a <choose> task (similar to the xsl:choose) as soon as possible, I think I'd prefer that over your proposal (although both could ofcourse coexist).
<choose> <when test="condition1"> ... </when> <when test="condition2"> ... </when> <otherwise> ... </otherwise> </choose>
What do you think ?
Gert
----- Original Message ----- From: "Jaroslaw Kowalski" <[EMAIL PROTECTED]>
To: "Gert Driesen" <[EMAIL PROTECTED]>
Cc: "Nick Zigomanis" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, September 16, 2004 9:00 AM
Subject: Re: [Nant-users] dynamic properties and functions
It should be possible to use the if() operator:
<property name="idl.out.dir" value="${ if(string::contains(this.idl, 'Source\Data'), bin.root + '\Data', if (string::contains(this.idl, 'Source\Common'), bin.root + '\Common', '')) }" dynamic="true" />
The semantics of if(a,b,c) is: "if a=True then b else c" which is exactly what "a ? b : c" operator from C/C++/C#.
Gert, what do you think of extending it to (backward compatible):
if (condition1,result1,condition2,result2, ..., conditionN,resultN, otherwise)
Other ideas (language constructs):
${if a then b else c} ${choose when condition1 then result1 when condition2 then result2 ... when conditionN then resultN otherwise resultOtherwise} Jarek
Gert Driesen wrote:
Nick,
The "if" condition is evaluated, not the value of the property.
Gert
----- Original Message ----- From: "Nick Zigomanis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 16, 2004 7:06 AM
Subject: [Nant-users] dynamic properties and functions
Hi all,
I'm trying to set dynamic properties in my build file as shown below:
<property name="idl.out.dir" value="${bin.root}\Common" dynamic="true" if="${string::contains(this.idl, 'Source\Common'}" />
<property name="idl.out.dir" value="${bin.root}\Data" dynamic="true" if="${string::contains(this.idl, 'Source\Data'}" />
Essentially, all idl's under a specific source hierarchy (which is tested by the string::contains function) are compiled to a single bin directory.
However, in doing the above, I get the following error when running the build script:
Property evaluation failed.
Expression: ${string::contains(this.idl, 'Source\Common'}
^^^^^^^^
Property 'this.idl' has not been set.
It seems that even though a dynamic property is specified, the function tries to do an evaluation even before the property is being used, i.e., in this case, it is not dynamic.
Can anyone confirm this, or point out any problems in my approach, or possibly, a better way to do this.
------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users
------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users