ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject Re: Make Dependencies
Date Fri, 06 Apr 2001 15:31:21 GMT
Ian,

If you want to create a dependency between A.class and b.class which is not
reflected in the source, the you are right, and <depend> will not help you.
I guess you can use uptodate as Diane suggested. I must admit, however, I
think it would be rare where you want to set up a compile dependency where
there is no source relationship between the classes.

So, in your example, I would guess you want to compile class b again
because it depends on class a which has changed. If that is the case, then
depend will work for you. It will work as follows. When you run depend, it
will examine the current class files a.class and b.class. from this it will
determine that b depends on a. It will also see that class a is out of date
with respect to its source file. Knowing that a.java is about to be
recomiled (since you would always place<depend> just before <javac>),
<depend> will remove b.class to force it to be recompiled. You will end up
compiling both a.java and b.java when a.java is newer than a.class.

If that is what you do want, then give <depend> a try.

BTW, Ant does not rely on javac to determine if a class needs to be
recompiled. It does its own datestamp check.

Conor

----- Original Message -----
From: "Macey, Ian" <ian.macey@cazenove.com>
To: <ant-user@jakarta.apache.org>
Sent: Friday, April 06, 2001 11:50 PM
Subject: RE: Make Dependencies


>
> Unfortunately that has the same problem as I'm currently suffering
> from. To quote from the depend.html:
>
> "Classes are considered out of date ... using the same mechanism
> as the javac task"
>
> I need to be able to say:
>
>   IF a.class NEWER THAN b.class THEN compile b.java
>
> Both the javac and depend tasks rely on analyzing the class files
> to find out whether to compile. I need a rule which gives regard
> only to the file timestamp, as is the case with Make.
>
>
> Ian
>
> > -----Original Message-----
> > From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
> > Sent: 06 April 2001 14:25
> > To: ant-user@jakarta.apache.org
> > Subject: Re: Make Dependencies
> >
> >
> > Check out the <depend> task
> > http://jakarta.apache.org/ant/manual/OptionalTasks/depend.html
> >
> > ----- Original Message -----
> > From: "Macey, Ian" <ian.macey@cazenove.com>
> > To: <ant-user@jakarta.apache.org>
> > Sent: Friday, April 06, 2001 10:39 PM
> > Subject: Make Dependencies
> >
> >
> > > How can I tell Ant that there is a dependency between two
> > > .java files? ie Given a.java and b.java, how do I say in Ant,
> > > if a.java is compiled then you must also compile b.java.
> > >
> > > Have had various attempts, the problems are getting javac
> > > to compile b.java even though b.class is later than b.java,
> > > and using something like touch, as in Ant every rule fires
> > > and I can't restrict the touch to occur only if a.java is
> > compiled.
> > >
> > > Doing this with Make would be easy, but I just don't see
> > > how to do it with Ant... Is this a fundamental problem due
> > > to Ant relying on javac to know whether a file needs to be
> > > compiled?
> > >
> > > Ian
> > >
> > >
> > > ___________________________________________________
> > > CAZENOVE & CO.
> > >
> > > DISCLAIMER, PLEASE NOTE:
> > >
> > > This communication is for the attention of the
> > > named recipient only and should not be passed
> > > on to any other person. Information relating to
> > > any company or security, is for information
> > > purposes only and should not be interpreted as
> > > a solicitation or offer to buy or sell any security.
> > > The information on which this communication is based
> > > has been obtained from sources we believe to be reliable,
> > > but we do not guarantee its accuracy or completeness.
> > > All expressions of opinion are subject to change
> > > without notice.
> > > ___________________________________________________
> > >
> >
>


Mime
View raw message