You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Ribeiro, Glauber" <gl...@experian.com> on 2000/09/05 19:57:12 UTC

File dependencies?

Hello,

sorry if this is a newbie kind of question, but the FAQ server seems to be
offline.

I just started using Ant, and i like it. I haven't figured out how to set up
a build.xml file so that Ant compiles only the files that have changed (like
you do with a makefile). Is there a way to do this? It just feels like there
should be.

Thanks!


glauber ribeiro
Glauber.Ribeiro@experian.com (Experian, Schaumburg IL)
Opinions stated are my own and not representative of Experian.


RE: File dependencies?

Posted by Conor MacNeill <co...@m64.com>.
I have added some verbose output to the Javac task where it will tell you
why it is deciding to compile a given class. This can help you pinpoint
where the Javac task is expecting to find your class files. I would also
note that the javac compiler, and not just the ant javac task, expects
source files to be organized according to their package.

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: Wednesday, 6 September 2000 17:31
> To: ant-user@jakarta.apache.org
> Subject: Re: File dependencies?
>
>
> >>>>> "BS" == Barbara Samson <bs...@vovida.com> writes:
>
>  BS> Based on the amount of time it takes to compile, I don't think
>  BS> this check is happening.
>
> Ant will tell you how many files it is going to compile. If it still
> says compiling 106 files in your second run your setup is not like Ant
> expects it to be.
>
> Given <javac srcdir="src" destdir="dest" /> if Ant finds a file
> src/a/b/C.java it expects it to be in package a.b so that the
> resulting .class file is going to be dest/a/b/C.class. If your setup
> is different Ant's heuristic won't work (we don't want to open every
> source file to see which package it belongs to) and it will recompile
> classes that are up to date.
>
> HTH
>
> Stefan
>


Re: File dependencies?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "BS" == Barbara Samson <bs...@vovida.com> writes:

 BS> Based on the amount of time it takes to compile, I don't think
 BS> this check is happening.

Ant will tell you how many files it is going to compile. If it still
says compiling 106 files in your second run your setup is not like Ant
expects it to be.

Given <javac srcdir="src" destdir="dest" /> if Ant finds a file
src/a/b/C.java it expects it to be in package a.b so that the
resulting .class file is going to be dest/a/b/C.class. If your setup
is different Ant's heuristic won't work (we don't want to open every
source file to see which package it belongs to) and it will recompile
classes that are up to date.

HTH

Stefan

Re: File dependencies?

Posted by Barbara Samson <bs...@vovida.com>.
Based on the amount of time it takes to compile, I don't think this check is
happening. It takes me the same amount of time (approx 1 minute) to compile 106
source files after cleaning out the class files as it does
to re-compile the source a second time with the class files still present.

I am running the latest CVS version on Linux.

Barbara

Chris Todd wrote

> If I'm not mistaken, that is the default behavior of Ant - it checks the
> last time modified of each .java file and compares it to any .class files it
> finds.  As a matter of fact, from the Ant manual:
> Javac
> Description
> Compiles a source tree within the running (Ant) VM.
>
> The source and destination directory will be recursively scanned for Java
> source files to compile. Only Java files that have no corresponding class
> file or where the class file is older than the java file will be compiled.
>
> This can be viewed at:
> http://jakarta.apache.org/cvsweb/index.cgi/jakarta-ant/docs/index.html?rev=1
> .90&content-type=text/html
>
> Chris Todd
> Software Engineer
> ctodd@alabanza.com
> Alabanza Corporation
>
> > -----Original Message-----
> > From: Ribeiro, Glauber [mailto:glauber.ribeiro@experian.com]
> > Sent: Tuesday, September 05, 2000 1:57 PM
> > To: 'ant-user@jakarta.apache.org'
> > Subject: File dependencies?
> >
> >
> > Hello,
> >
> > sorry if this is a newbie kind of question, but the FAQ server seems to be
> > offline.
> >
> > I just started using Ant, and i like it. I haven't figured out
> > how to set up
> > a build.xml file so that Ant compiles only the files that have
> > changed (like
> > you do with a makefile). Is there a way to do this? It just feels
> > like there
> > should be.
> >
> > Thanks!
> >
> >
> > glauber ribeiro
> > Glauber.Ribeiro@experian.com (Experian, Schaumburg IL)
> > Opinions stated are my own and not representative of Experian.
> >


RE: File dependencies?

Posted by Chris Todd <ct...@alabanza.com>.
If I'm not mistaken, that is the default behavior of Ant - it checks the
last time modified of each .java file and compares it to any .class files it
finds.  As a matter of fact, from the Ant manual:
Javac
Description
Compiles a source tree within the running (Ant) VM.

The source and destination directory will be recursively scanned for Java
source files to compile. Only Java files that have no corresponding class
file or where the class file is older than the java file will be compiled.

This can be viewed at:
http://jakarta.apache.org/cvsweb/index.cgi/jakarta-ant/docs/index.html?rev=1
.90&content-type=text/html

Chris Todd
Software Engineer
ctodd@alabanza.com
Alabanza Corporation


> -----Original Message-----
> From: Ribeiro, Glauber [mailto:glauber.ribeiro@experian.com]
> Sent: Tuesday, September 05, 2000 1:57 PM
> To: 'ant-user@jakarta.apache.org'
> Subject: File dependencies?
>
>
> Hello,
>
> sorry if this is a newbie kind of question, but the FAQ server seems to be
> offline.
>
> I just started using Ant, and i like it. I haven't figured out
> how to set up
> a build.xml file so that Ant compiles only the files that have
> changed (like
> you do with a makefile). Is there a way to do this? It just feels
> like there
> should be.
>
> Thanks!
>
>
> glauber ribeiro
> Glauber.Ribeiro@experian.com (Experian, Schaumburg IL)
> Opinions stated are my own and not representative of Experian.
>