You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Evan J <ma...@gmail.com> on 2007/07/20 05:49:29 UTC

Inclusion and Exclusion Confusion

Hi,

I have the following structure for a project:

com/host/proj/package1/subpackage/{*.java}
com/host/proj/package2/{*.java}
com/host/proj/test/package2/{*.java}

Note: test/package2 indicates that I am writing test cases for classes
in package2 (at least for now). I would like to compile the packages
in two separate targets: base classes and test classes. So in my javac
task I have the following for the base classes target javac:

destdir="build/classes"

<exclude name="com/host/proj/test/**" />
<include name="com/host/proj/package1/**" />
<include name="com/host/proj/package2/**" />

and for the test classes (different target javac):

destdir="build/test"

<include name="com/host/proj/test/**" />
<exclude name="com/host/proj/package1/**" />
<exclude name="com/host/proj/package2/**" />

The base classes are compile fine (only classes in package1 and
package2 are compiled) but the test compilation also includes classes
from package2. That is after compilation I have package2's classes
also included in my `build/test':

build/test/com/host/proj/test/package2/*.java
build/test/com/host/proj/package2/*.java <-- I DO NOT WANT THIS

And my base classes compilation:

build/classes/com/host/proj/package1/subpackage/*.java
build/classes/com/host/proj/package2/*.java

Can somebody shed light on what I am doing wrong?

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


Re: Inclusion and Exclusion Confusion

Posted by Evan J <ma...@gmail.com>.
I think you misunderstood me. The test target does indeed depend on
compilation of base classes. When I run the compile target for the
base classes _only_ (not the compile for test target), the compilation
of such classes result in a correct set of classes (only the base
classes) being compiled and placed in the appropriate
destdir[=build/classes].

When I run the target for test classes, as I mentioned, one of the
base classes' package directory (package2/*.java) is also included in
my test destination directory destdir[=build/test AND test/]. As a
matter of fact such inclusion occurs twice:

build/test/com/host/proj/test/package2/*.java
build/test/com/host/proj/package2/*.java <-- I DO NOT WANT THIS
test/com/host/proj/test/package2/*.java <-- I DO NOT WANT THIS
test/com/host/proj/package2/*.java <-- I DO NOT WANT THIS

test/ and build/ are on same level. Is there a way, after compilation
of test classes, to ONLY place such test classes in the designated
directory -- that is, the compilation of test classes should result in
ONLY:

build/test/com/host/proj/test/package2/*.java

And nothing else. How do I go about excluding all other base classes
and only include the test classes in the appropriate destination
directory?



On 7/20/07, RADEMAKERS Tanguy <Ta...@swift.com> wrote:
> >Can somebody shed light on what I am doing wrong?
>
> I'm guessing that your test classes refer to - i.e. depend on - the
> classes they test, right? So isn't it normal that the tested classes get
> compiled?
>
> /t
>
> ---------------------------------------------------------------------
> 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


RE: Inclusion and Exclusion Confusion

Posted by RADEMAKERS Tanguy <Ta...@swift.com>.
>Can somebody shed light on what I am doing wrong?

I'm guessing that your test classes refer to - i.e. depend on - the
classes they test, right? So isn't it normal that the tested classes get
compiled? 

/t

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