+1 to either of the ideas. Having an else is a must.

I wonder if it would be doable to have:

<if test="...">

'then' tasks here

<else/>        <!-- just a marker -->

'else' tasks here

</if>

Jarek

----- Original Message ----- 
From: "Gert Driesen" <[EMAIL PROTECTED]>
To: "McCullough, Gary" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, July 29, 2004 3:15 PM
Subject: Re: [Nant-users] Conditional arguments in <exec>


> Gary,
>
> The choose pattern is something I had in mind myself, so we might wanna
add
> this to the release plan for NAnt 0.8x (or 0.9), after all of the troops
> have given their ok ...
>
> Gert
>
> ----- Original Message ----- 
> From: "McCullough, Gary" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, July 29, 2004 3:05 PM
> Subject: RE: [Nant-users] Conditional arguments in <exec>
>
>
> On this note, let me throw in a wishlist item: I wish nant supported an
> if/else structure! Perhaps something like this:
>
> <if test="${a = 'debug'}">
> <!-- do a debug build -->
> <else>
> <!-- do a release build -->
> </else>
> </if>
>
> Or perhaps follow the xslt choose pattern?
>
> <choose>
> <when test="${a = 'debug'}">
> <!-- do a debug build -->
> </when>
> <otherwise>
> <!-- do a release build -->
> </otherwise>
> </choose>
>
> Or perhaps do a switch pattern:
>
> <switch test="${a}">
> <case value="debug">
> <!-- do a debug build -->
> </case>
> <case value="special">
> <!-- do a 'special' build -->
> </case>
> <default>
> <!-- do a release build -->
> </default>
> </switch>
>
> ________________________________
>
> Gary McCullough
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Troy Laurin
> Sent: Wednesday, July 28, 2004 11:07 PM
> To: John Ludlow; [EMAIL PROTECTED]
> Subject: RE: [Nant-users] Conditional arguments in <exec>
>
> John, to reply to your email in reverse order... (most relevant first)
>
> > Any ideas?
>
> Currently, the only way (AFAIK) to do what you want is to duplicate the
> exec task and surround it with guarding if/ifnot statements:
>
> <if test="${property::exists('prj.out')}">
>   <exec program="C:\Program Files\InstallShield X\System\IsCmdBld.exe">
>     <arg value="-p &quot;${prj.ism}&quot;"/>
>     <arg value="-b &quot;${prj.out}&quot;"/>
>   </exec>
> </if>
> <ifnot test="${property::exists('prj.out')}">
>   <exec program="C:\Program Files\InstallShield X\System\IsCmdBld.exe">
>     <arg value="-p &quot;${prj.ism}&quot;"/>
>   </exec>
> </ifnot>
>
> > I tried this (just on an off-chance):
> >
> > <exec program="C:\Program Files\InstallShield X\System\IsCmdBld.exe">
> > <arg value="-p &quot;${prj.ism}&quot;"/>
> > <if test="${property::exists('prj.out')}">
> > <arg value="-b &quot;${prj.out}&quot;"/>
> > </if>
> > </exec>
> >
> > which stops it failing, but the <arg> element is never actually used.
>
> I think this is because the xml parser isn't a validating parser, but
> the exec task doesn't have the required structure to store the /if/arg
> structure.  I'm not sure I like this in principle... it would be nice to
> at least have a 'strict' switch, which would use a stricter parser.
>
> > attribute).  However, this doesn't work since the value
> > attribute uses the prj.out property, which might not exist,
> > and the properties in this attribute are expanded even if the
> > condition evaluates to false.
>
> What would be nice is a patch to exec's arg elements to delay expansion
> of properties in the same fashion as property's value attribute.  It
> shouldn't be a difficult patch... if people are interested in this
> change, and I don't get indication that it's a bad idea, I'll have a
> look at it and submit a patch later today or tomorrow.
>
> -T
>
> 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 is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idG21&alloc_id040&op=ick
> _______________________________________________
> Nant-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-users
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idG21&alloc_id040&op=ick
> _______________________________________________
> Nant-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-users
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_idG21&alloc_id040&opĚk
> _______________________________________________
> Nant-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-users
>



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to