ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Kennard <pet...@livingwork.com>
Subject Re: Multiple files to <java> task
Date Sat, 20 Jan 2007 07:42:56 GMT
well got 80% of the way there :)

The below will make a list of the filename surrounded by quotes.
(havn't tried it as part of a line= constrct yet.

<fileset dir="${src.home}" id="xmlcode.files">
      <include name="*.xml"/>
</fileset>

<pathconvert targetos="unix"
              pathsep="&quot; &quot;"
              property="xmlfiles"
              refid="xmlcode.files"
 >
     <map from="${src.home}" to=""/>
</pathconvert>

<echo message="&quot;${xmlfiles}&quot;${line.separator}" />


However I noticed a buggaboo - the <map from="xx" to="xx" />  only 
does simple string substitution so unless you specify 
${path.separator} for every instance of it in all paths everywhere 
the mapping will not work right so my common practice of specifying 
all patht as unix paths when software recognizes them (ie: fileset 
does!) will not work.  Now I need to find the string substitutor so I 
can translate all the '/' to $path.separator} before the map operation

(xml is really the wrong thing to make a scripting system out of!)

:)


At 20:07 1/19/2007, you wrote:
>Hi,
>
>if your list of file is not too long, that is if you are not going to
>overflow the maximum for command lines (4096 chars under Windows I
>think), and if none of your files contain spaces in their names or
>directories, you can use pathconvert to generate a property from a
>fileset. Then you can pass this property with <arg line="$ {someproperty}"/>
>
>Regards,
>
>Antoine
>
>On Jan 19, 2007, at 4:54 PM, Peter Kennard wrote:
>
>>
>>I want to pass in a "list" of files as the last arguments to a java
>>utility.  Can this be done with the <java> task?  Any hints on how
>>I might go about it?  Traversing the apache docs, I couldn't find
>>how to do what I would think is one of the first things people
>>would need.
>>
>> From the command line executing the utility would be:
>>
>>java [...] XMLToCode.class *.xml
>>
>>In ant something liek the below:
>>
>><target name="GeneratedCode"
>>    depends="CodeGenerator"
>>    description="Generate Java code" >
>>    <java classname="CodeGenerator.XMLToCode"
>>        fork="true"
>>     >
>>         <classpath refid="compile.classpath"/>
>>         <arg value="-java"/>
>>         <arg value="javadir=${src.home}/Interfaces"/>
>>
>>         <!-- I want a "fileset" or some other file list
>>              to effectively make one <arg> for each item in the
>>list -->
>>     </java>
>></target>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message