Gert Driesen wrote:
>
> <property name="language" value="D#"/>
>
> <echo>${if (property::get-value('language')=='C#', '.cs', '.vb')}</echo>
>
I'm not sure if the D# was deliberate or a typo, but it highlights that
this approach doesn't handle the case when language isn't set properly,
nor does it scale well beyond two choices.
I'd prefer
<property name="extension" value="unknown" />
<property name="extension" value="cs" if="${language == 'C#'}" />
<property name="extension" value="vb" if="${language == 'VB or
language == 'Visual Basic'} />
<property name="extension" value="cpp" if="${language == 'C++'}" />
<property name="extension" value="java" if="${language == 'Java'}" />
and so on. This provides an easy hook for the case where language isn't
recognized, and it scales (in the sense that a long list of similar
statements is much easier to read and manage than a deeply nested
if(cond1,doTrue1,if(cond2,doTrue2, ... if(condN, doTrueN,
doUnknown))))...))).
Obviously, I'd put the above sequence into a setup target by itself.
Gary
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users