I like this. I assume the exactversion would determine whether it does a == (true) check or a >= (false) check?
Jeroen On Sat, 2004-08-14 at 07:13 +0200, Jaroslaw Kowalski wrote: > Gert, how about adding a nant-level functionality for that? > > <project nantversion="0.85.1123" exactversion="true|false"> > ... > </project> > > About the script task: Make sure you don't have xmlns defined in your > <project> element (to support intellisense). Mono seems to have problems > with that. > > Jarek > > > ----- Original Message ----- > From: "Jeroen Zwartepoorte" <[EMAIL PROTECTED]> > To: "Felice Vittoria" <[EMAIL PROTECTED]> > Cc: "Castro, Edwin Gabriel (Firing Systems Engr.)" <[EMAIL PROTECTED]>; "Gert > Driesen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, August 13, 2004 10:06 PM > Subject: RE: [Nant-users] checking nant version > > > > Hi Felice, > > > > Don't you mean <script> instead of <Xcript> in your example below? > > Neither works for me. Also, the ScriptTask in nant/examples also doesn't > > work for me. I tried it with the nightly build from yesterday as well. > > > > Perhaps this is some sort of Windows-only .Net functionality that is > > disabled somehow on Mono? > > > > Jeroen > > > > On Fri, 2004-08-13 at 15:36 -0500, Felice Vittoria wrote: > > > <p align="left"><b><font face="Arial" size="2">GFI MailSecurity's HTML > threat engine found HTML scripts in this email and has disabled > them.</font></b></p>Jeroen, > > > > > > 1. Change </Xcript> to </Xcript> at the end. So it would look like > this: > > > > > > <Xcript language="C#"><!-- > > > <code><![CDATA[ > > > [Function("version-greater-or-equal")] > > > public bool VersionGreaterOrEqual (string version1, string > > > version2) { > > > Version v1 = new Version (version1); > > > Version v2 = new Version (version2); > > > return v1 >= v2; > > > } > > > ]]></code> > > > --></Xcript> > > > > > > This works .. I tried it out. I used your version of Nant as well as > the latest. > > > > > > 2. I got that error too when I tried nant.version. So .. as a > workaround I used mynant.version, mynant.currentversion to see get this > example to work. > > > > > > HTH, > > > Felice > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] Behalf Of Jeroen > > > Zwartepoorte > > > Sent: Friday, August 13, 2004 1:21 PM > > > To: Castro, Edwin Gabriel (Firing Systems Engr.) > > > Cc: Gert Driesen; [EMAIL PROTECTED] > > > Subject: RE: [Nant-users] checking nant version > > > > > > > > > <p align=\"left\"><b><font face=\"Arial\" size=\"2\">GFI MailSecurity's > HTML threat engine found HTML scripts in this email and has disabled > them.</font></b></p>Hmm, nant is not recognizing the <Xcript><!-- task: > > > > > > Invalid element <script>. Unknown task or datatype. > > > > > > It doesn't seem to matter where i put the <script> task in the build > > > file. Is this a bug in a recent nightly build? (i'm using > > > nant-0.85-20040809). > > > > > > Btw: it seems "nant.version" is a predefined property. So i don't need > > > the "${assembly::get-version(nant::get-location())}" bit. Are these > > > properties documented somewhere? > > > > > > Jeroen > > > > > > p.s. relevant bits from default.build below (does the greater than sign > > > in "v1 >= v2" need to be escaped btw?): > > > > > > --><!-- script hack for checking nant versions --><!-- > > > <script language="C#"> > > > <code><![CDATA[ > > > [Function("version-greater-or-equal")] > > > public bool VersionGreaterOrEqual (string version1, string > > > version2) { > > > Version v1 = new Version (version1); > > > Version v2 = new Version (version2); > > > return v1 >= v2; > > > } > > > ]]></code> > > > --></Xcript> > > > > > > <!-- check for pkg-config dependencies and initialize properties --> > > > <target name="init" description="initializes build properties"> > > > <!-- check for an up-to-date nant --> > > > <if test="${not(script::version-greater-or-equal(nant.version, > > > nant.neededversion))}"> > > > <echo message="MonoDevelop requires nant version > > > ${nant.neededversion} or greater"/> > > > <fail message="nant version not supported"/> > > > </if> > > > > > > > > > > > > On Fri, 2004-08-13 at 12:45 -0500, Castro, Edwin Gabriel (Firing Systems > > > Engr.) wrote: > > > > I would recommend that you use the <Xcript><!-- task to create your > own > > > > custom function taking two strings and returning a boolean. You can > then > > > > use the System.Version class to actually do the comparison. Something > > > > like this: > > > > > > > > <script language="C#"> > > > > <code><![CDATA[ > > > > [Function("version-greater-or-equal")] > > > > public bool VersionGreaterOrEqual(string version1, string > version2) > > > > { > > > > Version v1 = new Version(version1); > > > > Version v2 = new Version(version2); > > > > return v1 >= v2; > > > > } > > > > ]]></code> > > > > --></Xcript> > > > > > > > > You can then call it like this: > > > > > > > > <property name="nant.version" value="0.85.1684.0"/> > > > > <property name="nant.currentversion" > > > > value="${assembly::get-version(nant::get-location())}"/> > > > > > > > > <if test="${script::version-greater-or-equal(nant.currentversion, > > > > nant.version)}"> > > > > <!-- Do something --> > > > > </if> > > > > > > > > I'm sure there are other ways too! > > > > > > > > -- > > > > Edwin G. Castro > > > > Firing Systems Engineer > > > > [EMAIL PROTECTED] > > > > > > > > > > > > -----Original Message----- > > > > From: [EMAIL PROTECTED] > > > > [mailto:[EMAIL PROTECTED] On Behalf Of Jeroen > > > > Zwartepoorte > > > > Sent: Friday, August 13, 2004 8:26 AM > > > > To: Gert Driesen > > > > Cc: [EMAIL PROTECTED] > > > > Subject: Re: [Nant-users] checking nant version > > > > > > > > Hi Gert, > > > > > > > > Thanks for the quick reply. Still have a question though: > > > > > > > > How do i actually check if the current nant version is >= than the > > > > version i need? > > > > > > > > I now have this: > > > > > > > > <property name="nant.version" value="0.85.1684.0"/> > > > > > > > > and > > > > > > > > <property name="nant.currentversion" value="${assembly::get-version > > > > (nant::get-location())}"/> > > > > > > > > How do i compare these two values? It looks like i could extract the > > > > major, minor, build and revision numbers using the version::get-* > > > > functions, but i still need some sort of string::compare function in > > > > order to actually compare them... > > > > > > > > How do i do this? (i don't see any functions in the docs which support > > > > this) > > > > > > > > Thanks, > > > > > > > > Jeroen > > > > > > > > On Fri, 2004-08-13 at 19:06 +0200, Gert Driesen wrote: > > > > > ----- Original Message ----- > > > > > From: "Jeroen Zwartepoorte" <[EMAIL PROTECTED]> > > > > > To: <[EMAIL PROTECTED]> > > > > > Sent: Friday, August 13, 2004 4:28 PM > > > > > Subject: [Nant-users] checking nant version > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > Is there some example nant XML that checks that nant is actually > > > > > > able to build the project in question? So "nant.version >= > > > > > > 0.85-20040810" for example? So you can tell the user that he has > to > > > > > > upgrade his nant if he wants to build the project. > > > > > > > > > > You can use assembly::get-version(nant::get-location()) to get the > > > > > full version of NAnt. > > > > > > > > > > > Seems very useful to me when you're using the latest stuff like > > > > > > filterchains. Also prevents a lot of possible FAQ from appearing > on > > > > irc. > > > > > > > > > > I agree. We'll need to think of a more generic way to accomplish > this. > > > > > > > > > > > btw: do the nant devs hang around on irc? If so, which server and > > > > > > what channel? > > > > > > > > > > I hang around on the #mono channel on ircd.gimp.org > > > > > > > > > > Gert > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > > > > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save > > > > 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > > > > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > > > > _______________________________________________ > > > > Nant-users mailing list > > > > [EMAIL PROTECTED] > > > > https://lists.sourceforge.net/lists/listinfo/nant-users > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > > > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > > > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > > > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > > > _______________________________________________ > > > Nant-users mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/nant-users > > > > > > > > > > > > > > ------------------------------------------------------- > > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > > _______________________________________________ > > Nant-users mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/nant-users > > > > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Nant-users mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-users > ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users