Every time I see constructs like this I want to scream for the support of
simple expression evaluator, because without them NAnt syntax gets uglier
every time someone invents a potentially useful extension.
MSBuild has a very simple EE here, and I think it's a good idea to support
it too.
I think ours should have some basic operators =, !=, some environmental
functions for working
with files (exists(file), lastmod(file)), plus some string operators (like
"startsWith", "endsWith", "contains", substring", "concat", "uppercase",
"lowercase", "length" - XPath functions can be a guide here).
Data types supported would be strings, integers, and datetimes.
So the previous example would be a simple one-liner:
<if test="'${myOne}'='${myOther}'">
</if>
Assuming you have a tokenizer - which is pretty easy in this case - writing
a simple, recursive parser should be trivial.
I've written many parsers/evaluators in C# and would be glad to help here.
Jarek
----- Original Message -----
From: "Jean Rajotte" <[EMAIL PROTECTED]>
To: "'Sean Perkin'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, November 13, 2003 10:55 PM
Subject: RE: [Nant-users] How to compare two property values
> the only way that comes to mind is to write a script (my standard cheat
> :)
>
> <target name="test-compare" >
> <property name="myOne" value="obo" />
> <property name="myOther" value="obo" />
>
> <property name="compare.a" value="myOne" />
> <property name="compare.b" value="myOther" />
> <call target="compare.equal" force="true" />
>
> <echo message="${compare.result}" />
>
>
> </target>
>
> <target name="compare.equal" >
> <script language="C#"><code><![CDATA[
> public static void ScriptMain( Project project ) {
> string a = project.Properties[ project.Properties[ "compare.a"] ];
> string b = project.Properties[ project.Properties[ "compare.b"] ];
> project.Properties[ "compare.result" ] = (a==b) ? "true" :
> "false";
> }
> ]]></code></script>
> </target>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Sean Perkin
> Sent: Thursday, November 13, 2003 15:28
> To: [EMAIL PROTECTED]
> Subject: [Nant-users] How to compare two property values
>
>
> Hi Folks,
>
> Does anyone know how to compare two property values in NAnt?
>
> Regards,
>
>
> Sean Perkin
> Build Developer
> Cactus Commerce
> 819.778.0313 . 315 819.771.0921
> http://www.cactuscommerce.com
> [EMAIL PROTECTED]
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: ApacheCon 2003,
> 16-19 November in Las Vegas. Learn firsthand the latest
> developments in Apache, PHP, Perl, XML, Java, MySQL,
> WebDAV, and more! http://www.apachecon.com/
> _______________________________________________
> Nant-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-users
>
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users