cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: Javac task design problems
Date Wed, 26 Feb 2003 20:52:22 GMT
Stefano Mazzocchi wrote:

<snip/>

> The ideal solution to the problem (without requiring to filter 
> everything out would be)
>
>     <copy todir="${build.src}" filtering="on">
>       <fileset dir="${src}">
>         <include name="**/Constants.java"/>
>       </fileset>
>     </copy>
>
>     <javac destdir="${build.dest}">
>       <src>
>        <fileset dir="${src}">
>         <exclude name="**/Constants.java"/>
>        </fileset>
>        <path location="${build.src}"/>
>       </src>
>     </javac>
>
> too bad it doesn't work because the <javac> tasks assumes that each 
> file in its fileset is a directory!


Fortunately, it *does* work ;-)

Read Ant's javac task documentation and you will see that it supports 
includes and exclude patterns.

I checked if the doc is right (you never know ;) with the following
change on build.xml (added the <exclude>) and it works just fine :

     <!-- compile core source files -->
     <javac destdir="${build.dest}"
            debug="${compiler.debug}"
            optimize="${compiler.optimize}"
            deprecation="${compiler.deprecation}"
            target="${target.vm}"
            nowarn="${compiler.nowarn}"
            compiler="${compiler}"
            classpathref="classpath">
          <src>
           <!-- [FIXME] THE DEPENDENCY ON DEPRECATED SHOULD GO AWAY!!!! -->
           <path location="${deprecated.src}"/>
           <path location="${build.src}"/>
           <path location="${java}"/>
          </src>
          <exclude name="org/apache/cocoon/acting/Request*.java"/>
     </javac>

This means that we can handle source files filtering without copying the 
full source tree : only filter those files that require it and exclude 
them from the main source tree in the javac task.

Or, if filtering is removed (didn't follow the ongoing discussion), this 
can be used to exclude source files specific to a particular JDK version.

Sylvain
(on vacation, trying to follow the huge flood with a slow modem)

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }





Mime
View raw message