You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sven Köhler <sv...@gmail.com> on 2009/03/21 14:52:17 UTC

incremental compilation

Hi,

according to the docs it seems, that ant is (still) not suitable for 
incremental compilation. Is that true?

Quote from the docs of the depend task:

********************************************************************
The most obvious example of these limitations is that the task can't 
tell which classes to recompile when a constant primitive data type 
exported by other classes is changed. For example, a change in the 
definition of something like

public final class Constants {
   public final static boolean DEBUG=false;
}

will not be picked up by other classes.
********************************************************************


Yes, the good constant-inlining. So there is really nothing implemented 
to detect that? That is: if I don't do an "ant clean" once in a while, 
then i will have inconsistent class files?

I'm rather amazed. But the trouble seems to be, that modern javac 
doesn't generate any dependency information in addition to or inside the 
class files. Is that right?


Regards,
   Sven


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


Re: incremental compilation

Posted by David Weintraub <qa...@gmail.com>.
When I was a C developer, we had similar dependency issues with C and
Make. Changing a static constant in one source file didn't cause all
objects to recompile .And, if we didn't put it in our Makefiles,
changing a *.h file didn't necessarily recompile the source code that
depended upon it. We just had to know these things. It's why they paid
us the big money. Well, not the big money, but we did get stock
options.

Java's dependency tree rebuilding (which is really part of Java and
not Ant) is no worse than what we previously had in other programming
languages. It works about 99% of the time, and you simply had to know
when it might not work and redo a clean build.

To get TRUE dependency checking, you'll have to get something like
ClearCase and use dynamic views. ClearCase tracks all dependencies for
all built objects. Of course it is slow and expensive which is why not
too many other version control systems do it.

On Sat, Mar 21, 2009 at 9:52 AM, Sven Köhler <sv...@gmail.com> wrote:
> Hi,
>
> according to the docs it seems, that ant is (still) not suitable for
> incremental compilation. Is that true?
>
> Quote from the docs of the depend task:
>
> ********************************************************************
> The most obvious example of these limitations is that the task can't tell
> which classes to recompile when a constant primitive data type exported by
> other classes is changed. For example, a change in the definition of
> something like
>
> public final class Constants {
>  public final static boolean DEBUG=false;
> }
>
> will not be picked up by other classes.
> ********************************************************************
>
>
> Yes, the good constant-inlining. So there is really nothing implemented to
> detect that? That is: if I don't do an "ant clean" once in a while, then i
> will have inconsistent class files?
>
> I'm rather amazed. But the trouble seems to be, that modern javac doesn't
> generate any dependency information in addition to or inside the class
> files. Is that right?
>
>
> Regards,
>  Sven
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
--
David Weintraub
qazwart@gmail.com

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


Re: incremental compilation

Posted by Brian Pontarelli <br...@pontarelli.com>.
How large is your codebase that you are looking to use incremental  
compilation. Most java compilers are pretty fast and re-compiling 1000  
classes doesn't take very long (couple seconds).

The issue is that the tool that determines if a class needs to be re- 
compiled must fully understand the structure of all the other classes  
in the compilation unit. This generally means parsing the source or  
the bytecode. This requires almost as much work as compiling the  
entire codebase again.

On the flip side, most IDEs keep a graph of dependencies that they are  
constantly rebuilding as you work. Making this same sort of thing work  
for Ant calling javac would mean writing out a file somewhere that  
stored the graph and loading it up before the build runs. The trick is  
to keep that graph up to date. What it would probably mean is that you  
probably end up spending more time rebuilding the graph and then  
compiling during a build.

Unless you could hook into the graph that the IDE creates, you'll  
probably better off just re-compiling the code base.

-bp

On Mar 21, 2009, at 7:52 AM, Sven Köhler wrote:

> Hi,
>
> according to the docs it seems, that ant is (still) not suitable for  
> incremental compilation. Is that true?
>
> Quote from the docs of the depend task:
>
> ********************************************************************
> The most obvious example of these limitations is that the task can't  
> tell which classes to recompile when a constant primitive data type  
> exported by other classes is changed. For example, a change in the  
> definition of something like
>
> public final class Constants {
>  public final static boolean DEBUG=false;
> }
>
> will not be picked up by other classes.
> ********************************************************************
>
>
> Yes, the good constant-inlining. So there is really nothing  
> implemented to detect that? That is: if I don't do an "ant clean"  
> once in a while, then i will have inconsistent class files?
>
> I'm rather amazed. But the trouble seems to be, that modern javac  
> doesn't generate any dependency information in addition to or inside  
> the class files. Is that right?
>
>
> Regards,
>  Sven
>
>
> ---------------------------------------------------------------------
> 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


AW: incremental compilation

Posted by Ja...@rzf.fin-nrw.de.
It depends on what you think of "incremental compilation".
- differences in the number of files are compiled
- differences inside files are not recognized: the whole file will be recompiled.

But these is not Ant specific - this is based on the underlying compiler, usually the one from the JDK.
IMHO the Eclipse compiler could work in the 2nd "incremental manner". But I havent tried to plugin in that compiler into Ant. This should be possible using <javac fork="" executable=""/>. 
Patches for extending the compiler list used for 
  <property name="eclipse.home" value="..."/>
  <javac compiler="eclipse"/> 
are welcome ;)


Jan

>-----Ursprüngliche Nachricht-----
>Von: news [mailto:news@ger.gmane.org] Im Auftrag von Sven Köhler
>Gesendet: Samstag, 21. März 2009 14:52
>An: user@ant.apache.org
>Betreff: incremental compilation
>
>Hi,
>
>according to the docs it seems, that ant is (still) not suitable for 
>incremental compilation. Is that true?
>
>Quote from the docs of the depend task:
>
>********************************************************************
>The most obvious example of these limitations is that the task can't 
>tell which classes to recompile when a constant primitive data type 
>exported by other classes is changed. For example, a change in the 
>definition of something like
>
>public final class Constants {
>   public final static boolean DEBUG=false;
>}
>
>will not be picked up by other classes.
>********************************************************************
>
>
>Yes, the good constant-inlining. So there is really nothing 
>implemented 
>to detect that? That is: if I don't do an "ant clean" once in a while, 
>then i will have inconsistent class files?
>
>I'm rather amazed. But the trouble seems to be, that modern javac 
>doesn't generate any dependency information in addition to or 
>inside the 
>class files. Is that right?
>
>
>Regards,
>   Sven
>
>
>---------------------------------------------------------------------
>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