I've noticed something appearing a few times in my build files, and I'm just wondering if other people have had similar issues, or if there's a better approach to doing this...
Basically I'm coming up against situations in which I want to set an _attribute_ or not (of a task) based on some test. The most common incarnation of this is in the exec task: <if test="${property::exists('devenv.path')}"> <exec program="${devenv.exe}" basedir="${devenv.path}" ... /> </if> <ifnot test="${property::exists('devenv.path')}"> <exec program="${devenv.exe}" ... /> </if> Basically, if a particular path has been specified, then use the executable in that location, otherwise use the first one found in the user's path as normal. (We have a mixture of VS.NET 2002 and 2003 solutions here, just to keep things interesting) Even if the task were extended (Or the project framework itself were extended, so all tasks implicitly support this behaviour... But is that a good idea?) to allow basedir as a nested element: <exec program="${devenv.exe}"> <basedir value="${devenv.path}" if="${property::exists('devenv.path')}" /> </exec> This won't work either, unless the 'value' property is not expanded until the value is requested and the test is positive... If the test is negative, then the expansion will throw an exception. As an aside, the side-effects of immediate property expansion in attributes also means that the exec task must be in an if/ifnot test, rather than the more concise if/unless form, so the property is only expanded if it exists. Could this problem be solved with a function? <exec program="${devenv.exe}" basedir="${property::value('devenv.path')}" /> If the property with the given name exists, the function returns the value; if the property doesn't exist, the function returns null... Would this correctly behave as if the 'basedir' attribute wasn't set? -- Troy Disclaimer Message: This message contains confidential information and is intended only for the individual(s) named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please immediately delete it and all copies of it from your system, destroy any hard copies of it, and notify the sender. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. To the maximum extent permitted by law, Immersive Technologies Pty. Ltd. does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users