Jaroslaw Kowalski wrote:
Thats right - I remembered that. I actually thought it had already been added and I went looking for it in the source :) . I think its a good addition. Re-reading that thread it looks like we all agreed in principle just that no one got around to adding it. If put in fileset functions do we do it now or post 0.85 ?Ian, Gert, how about this:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg03737.html
Some time ago I posted an implementation of "fileset" family of functions that works with named filesets. Can we include it in NAnt?
Ian
Jarek
----- Original Message ----- From: "Ian MacLean" <[EMAIL PROTECTED]>
To: "Rodrigo B. de Oliveira" <[EMAIL PROTECTED]>
Cc: "nant-users" <[EMAIL PROTECTED]>
Sent: Thursday, August 05, 2004 5:43 AM
Subject: Re: [Nant-users] Passing a fileset as argument to external program
awesome.Rodrigo B. de Oliveira wrote:
Hi, I'm migrating an ant based build file to nant. One of the things I need to migrate is the invocation of the java vm passing a classpath as an argument, ant allows one to do it like this:
<java classname="junit.textui.TestRunner"> <classpath> <fileset dir="jsunit/lib"> <include name="*.jar"/> </fileset> <fileset dir="jsunit/bin"> <include name="jsunit.jar"/> </fileset> </classpath> <arg value="net.jsunit.StandaloneTest" /> </java>
My question is how can I achieve the same effect with the exec task?
<exec program="java"> <!-- is there any way to get a filelist from a fileset and put it here? --> <arg value="-cp ?????" /> <arg value="junit.textui.TestRunner" /> <arg value="net.jsunit.StandaloneTest" /> </exec>
Right now there is no support for this in the exec task directly although now that I think about it it seems reasonable to have a fileset child element on <exec> that just passes the files a list of quoted strings at the end of the arg list - although not all commandline apps will want it formatted that way.
Heres how you could do it using the <script> task:
<project name="test" > <script language="C#"> <imports> <import name="NAnt.Core.Types" /> </imports> <code><![CDATA[ [Function("fileset-tolist")] public string FileSetToList( string fset ) { FileSet fs = (FileSet)Project.DataTypeReferences[fset]; StringBuilder sb = new StringBuilder(); foreach(string file in fs.FileNames ){ sb.AppendFormat(" \"{0}\" ", file ); } return sb.ToString(); }
]]></code> </script> <fileset id="foo"> <include name="*.jar"/> </fileset> <exec program="java"> <arg value="${script::fileset-tolist('foo')}" /> </exec> </project>
I'm also considering implementing a java task just for the fun of itA java task would be kinda cool - somthing that works ikvm would be
but I'd like to keep my life simple :)
Ian
------------------------------------------------------- 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
--
Ian MacLean, Developer, ActiveState, a division of Sophos
http://www.ActiveState.com
------------------------------------------------------- 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