ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "didge" <>
Subject RE: preprocessing java source
Date Sun, 08 Sep 2002 21:00:20 GMT
There isn't any real disadvantage to using the <ppjavac> task to preprocess
as a distinct task before <javac>.  But, just as the C preprocessor is
automatically called for you, I wanted the <ppjavac> to be integrated into
the task for compilation, a sort of drop in replacement for the javac task.
However, an additional option could be added that would allow compilation to
be optional.  Then you could preprocess and compile in two steps, as
desired.  You would only have to coordinate the location of the preprocessed
files between the two tasks.

I'm not exactly clear on the development process you're suggesting in your
second comment, but the concern of checking in preprocessed files is that
one you check in a preprocessed file, all the information that yielded the
file, e.g. VTL directives, cpp #define, etc., are lost and you can't go back
(except maybe manually and at great effort).

The problem with developing source using a preprocessor is just the same as
in C or C++.  But, in both C and C++, pragma are used to coordinate
debugging with the original source.  Java has no such facility, at least no
standard one that I know of that is exposed, so debuggers can only go
against the preprocessed file.  So, if you want to debug, you must use the
preprocessed output, but only make your changes to the source.


-----Original Message-----
From: Curt Arnold []
Sent: Saturday, September 07, 2002 11:00 PM
To: Ant Developers List;
Subject: Re: preprocessing java source

didge wrote:

> Essentially, I subclassed the Javac ant task, and used Velocity to
> preprocess each file as if they were template files. Then, I let Javac
> continue to compile just the preprocessed files.


> On the bummer side, you must use ant to build effectively.  This is
> mitigated a bit by the fact that most IDEs now let you execute your ant
> targets directly, but you have to be smart about debugging.  You can no
> longer debug against the original source, you now have to go against the
> source in the temporary directory, unless your java-commented VTL is very
> carefully written.

What would be the disadvantage as doing the preprocessing as a distinct task
before the current <javac> task?

You may still be able to IDE develop if you worked on the preprocessed file
and then merged the new preprocessed file with the original source file
using the preprocessed version of the original file as the base to create a
new version of the source.  It might be a good companion task that would
incorporate changes in the preprocessed code into the source tree using
CVS's merge utility.

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

View raw message