Andy Stevens wrote:

2008/7/2  <[EMAIL PROTECTED]>:
Hi Raymond,

Thanks for your reply.
Actually I have two <javac> task in my build.xml. First <javac> task would
compile everything from src dir "Adir" and jar it. Second <javac> task
will compile a few java file from "Bdir" which could override some of
first ones and create another jar again. If I put a delete task before
second javac task, I would need to selectively delete some java classes
instead of deleting the whole output directory which is a little bit
complex :-). It would be nice if there is some other options to do this.
I tried using "touch" java source before second <javac>. It works but it
changes the source code modified time which is not desirable.

Why not <copy> the sources from each of those source directories in
turn to some other directory (build/mergedsrc?), then run a single
<javac> on that directory instead?
Using <copy preservelastmodified="true"> should ensure the javac
doesn't think the combined source files have changed unless the
corresponding ones in the original directory (or their overrides)
have, and therefore shouldn't recompile any classes unless it needs
to.


Andy.
Alternately, you could do the delete using a present filter with a mapper (it's really not so complicated), so you only delete classes with sources in Bdir. Or copy classes that don't have sources in BDir to an alternate build dir, so your jar tasks are repeatable. Or merge the sources as recommended above.

Of course, IMHO, the better solution would be to not have two different distributions in which the same classes (by name) have different behaviors. That sounds a little screwy to me. Different implementations of the same interface? OK One class extends the other and modifies behaviors? OK Re-compile codebase with a few source files replaced to change behavior? Kinda sounds like the wrong way to go about it.

--
Geoffrey Mitchell
Programmer/Analyst
Home Decorator's Collection
314-684-1062

Reply via email to