ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean Lazarou <>
Subject RE: javac
Date Wed, 13 Jul 2005 06:25:49 GMT
Ok, you approach is fine, even if it doesn't fit my situation as I should find at what *levels*
of the tree structure I should apply your idea.
If you look at the Javac Task implementation you can see that it is not far from beeing an
API, the Javac developer could publish that his/her implementation (1) finds all the files
to compile, in the execute method, storing the result in a *protected* variable (not a private
like some other variables) (2) calls the compile method... from a OO perspective it looks
like an invitation to extension.
With open-source you can spend time to look at the code and learn how people implemented things...
and then have ideas on how to add custom things. If later on the new stuffs can help anyone,
it's better. That's the reason I registered myself on this list. To share what I did, in case
others think it would be of any interrest. 
The extension I made could be a parameter in the nomal Javac implementation, like beeing able
to pick up the right compilation strategy. So, not having the problem you described with new

Kenneth Wood <> wrote:
Just FYI, I have legacy code I need to compile, I have been
building it with ant for years... 

I just structure my build.xml to compile sections, 
i.e. includes="Z/**/*.java"/>


And so on for 26 sections!

It has worked fine...

Ugly, yes. But, it doesn't require extensions to Ant, which
can be problematic when moving from one version of Ant to
another (and this code started out being compiled with
Ant 1.1 maybe - so long ago I don't remember.... and now is
up to Ant 1.6.1)

-----Original Message-----
From: Jean Lazarou [] 
Sent: Tuesday, July 12, 2005 9:53 AM
To: Ant Developers List
Subject: RE: javac

Do you think we can pick up any splitting for the subsystem to compile?

How can you be sure, when you're not developer of the project, that some
sub-tree won't imply that, due to compilation dependencies, again too
much files to compile at once? Even the approach I wrote is not full

Any way, creating a new task that derives from the ant Javac task
implemention was pretty easy to do.

I thank you for you advice.


Dominique Devienne 
Phil is right Jean. Independently of splitting the code in subsystems,
which is always a good idea, even if you can't do that you can split the
compile of a single source tree into several passes using regular . This
can even enforce dependencies of the code compiled by the different
passes. The trick is to reset the sourcepath that normally sets.

I include here an example for reference. Hope this helps. --DD

Compile the java code from src/ into build/classes

when not forking , and instead specify directly the
JVM argument only when forking... Convoluted, but works! -->

destdir="@{destdir}" sourcepath=""
deprecation="${deprecation}" debug="true" verbose="false"
includeAntRuntime="false" fork="@{fork}"> -->

> -----Original Message-----
> From: Phil Weighill Smith []
> Why not simply put two calls to javac in your build script and split 
> the source tree in two in the same way that you have in your new task,

> passing one tree to the first call and the other to the second?
> Clearly you need to ensure that the first call compiles 
> "pre-requisite" code for the second call and that you should avoid 
> cyclic references between the two sets of classes.
> On Tue, 2005-07-12 at 00:12 -0700, Jean Lazarou wrote:
> > We had problem with a (legacy) build from scratch, seems that, 
> > because
> we have too many java files to compile, nothing is compiled (both on 
> Linux and Windfoos2000).
> >
> > After spending 4 days on that, I decided to split the compilation, I
> created a new task, name "bydir-javac". The task is derived from 
> Javac.
> >
> > Can I publish this? Is it a better way of doing it?

To unsubscribe, e-mail:
For additional commands, e-mail:

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 

To unsubscribe, e-mail:
For additional commands, e-mail:

 Start your day with Yahoo! - make it your home page 
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message