ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: AW: Passing a list of files to javac
Date Thu, 11 Mar 2010 13:34:41 GMT
Have you tried wrapping a refid'd fileset in a <src> (path) element  
nested in <javac>?  That, according to the manual, should work (note  
that you can nest any filesystem-based resource collection into a  
path).  This presumes you're using Ant 1.7+...

HTH,
Matt

On Mar 11, 2010, at 4:42 AM, Robert Menteer wrote:

> That solves the minor problem of ; vs , but doesn't solve the real  
> problem. The real problem is in getting javac to recognize a  
> filelist/fileset/path. What I'm looking for is something to replace  
> the filelist that javac will accept.
>
> On Mar 11, 2010, at 2:23 AM, Jan.Materne@rzf.fin-nrw.de wrote:
>
>> -        <filelist dir="." files="@{sourceref}" />  <-- email is  
>> about this
>> +        <filelist dir="." refid="@{sourceref}" />  <-- email is  
>> about this
>>
>> Jan
>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Robert Menteer [mailto:reetnem@me.com]
>>> Gesendet: Mittwoch, 10. März 2010 21:28
>>> An: user@ant.apache.org
>>> Betreff: Passing a list of files to javac
>>>
>>> How can I get the javac task to use an existing fileset? In my
>>> build.xml I have created several filesets to be used in
>>> multiple places throughout build file. Here is how they have
>>> been defined:
>>>
>>>   <fileset dir = "${src}"
>>>       id       = "java.source.all">
>>>     <include name =  "**/*.java" />
>>>   </fileset>
>>>
>>>   <fileset dir = "${src}"
>>>       id       = "java.source.examples">
>>>     <include name = "**/Examples/**/*.java" />
>>>   </fileset>
>>>
>>>   <fileset dir = "${src}"
>>>       id       = "java.source.tests">
>>>     <include name = "**/Tests/*.java" />
>>>   </fileset>
>>>
>>>   <fileset dir = "${src}"
>>>       id       = "java.source.project">
>>>     <include name = "**/*.java"             />
>>>     <exclude name = "**/Examples/**/*.java" />
>>>     <exclude name = "**/Tests/**/*.java"    />
>>>   </fileset>
>>>
>>> I have also used macrodef to compile the java files so the
>>> javac task does not need to be repeated multiple times. The
>>> macro looks like this:
>>>
>>> <macrodef name="compile">
>>>   <attribute name="sourceref"/>
>>>   <sequential>
>>>     <javac srcdir         = "${src}"
>>>         destdir           = "${build}"
>>>         classpathref      = "classpath"
>>>         includeantruntime = "no"
>>>         debug             = "${debug}">
>>>       <filelist dir="." files="@{sourceref}" />  <-- email
>>> is about this
>>>     </javac>
>>>   </sequential>
>>> </macrodef>
>>>
>>> What I'm trying to do is compile only the classes that are
>>> needed for specific targets not all the targets in the source
>>> tree. And do so without having to specify the files every
>>> time. Here are how the targets are defined:
>>>
>>> <target name = "compile-examples"
>>>     depends  = "init">
>>>   <compile sourceref = "${toString:java.source.examples}" />
>>> </target>
>>>
>>> <target name = "compile-project"
>>>     depends  = "init">
>>>   <compile sourceref = "${toString:java.source.project}" />
>>> </target>
>>>
>>> <target name = "compile-tests"
>>>     depends  = "init">
>>>   <compile sourceref = "${toString:java.source.tests}" />
>>> </target>
>>>
>>> As you can see each target specifies the java files to be
>>> compiled as a simi-colon separated list of absolute file
>>> names. The only problem with this is that javac does not
>>> support filelist. It also does not support fileset, path or
>>> pathset. I've tried using <include name = "@{sourceref}" />
>>> but it treats the list as a single file name. Another thing I
>>> tried is sending the reference directly (not using toString)
>>> and using <include ref = "@{sourceref}" /> but include does
>>> not have a ref attribute.
>>>
>>> I've done a search of this list and noticed another person
>>> with a similar problem. But while it was discussed no solution
>>> was presented.
>>>
>>> SO THE QUESTION IS: How do you get the javac task to use a
>>> reference to a fileset that was defined in another part of the
>>> build file? I'm not interested in solutions that cause me to
>>> have multiple javac tasks. Completely re-writting the macro is
>>> acceptable. Changes to the targets are also acceptable
>>> provided redundant code between targets is kept to a minimum.
>>>
>>> p.s. Another problem is that fileset wants a comma separated
>>> list. I've only done a brief search for a way to convert
>>> semi-colons to commas and haven't found a way to do that.
>>>
>>> p.p.s. Sorry for the yelling but some people are too quick to
>>> post responses that don't address the subject.
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Mime
View raw message