You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jason Crickmer <jc...@hire.com> on 2001/05/02 15:15:16 UTC

basic file dependency

I am new to the list, so please pardon me if this question has been
asked before...

We have moved from Make to Ant, but there are some lingering issues
that I need to try to resolve.  The most important is, how does file
dependency work?

Take this Makefile for example:

.PHONY: mytarget

CP_XERCES=/opt/ApacheGroup/xerces-1.2.3/xerces.jar

mytarget: ../rel/etc/product.conf

../rel/etc/product.conf: Makefile etc/product.conf
	perl -p -e 's(_CP_XERCES_)(${CP_XERCES});' etc/product.conf > $@


So, when run, if Makefile OR etc/product.conf is newer than
../rel/etc/product.conf, then the Perl command will be run.  If not,
nothing happens.

The only way I see to do this in Ant would be to create a new variable
and some how set it to true or false depending on the file age
compared to its source.  But, the only thing I have found based on
modification times is the "copy" task.

Any assistance is appreciated!

Thanks,
Jason

Re: basic file dependency

Posted by Stefan Bodewig <bo...@apache.org>.
Jason Crickmer <jc...@hire.com> wrote:

> Is there an include mechanism,

A very basic one, see
<http://jakarta.apache.org/ant/faq.html#xml-entity-include> - more to
come in Ant2.

> or even better, a
> run-this-ant-file-in-a-separate-name-space-while-exporting-these-variables
> mechanism?

As part of Ant2, yes.

Stefan

Re: basic file dependency

Posted by Jason Crickmer <jc...@hire.com>.
Conor,

Thanks, that seemed to do the trick.  It seems a little more verbose,
and the variable name-space is going to get pretty cluttered.  Although
we moved to Ant from Make because most developers deplored the
"Makefile in each directory" architecture that we had, I am thinking
the "all-in-one" approach may get pretty cumbersome after a while,
too.  Is there an include mechanism, or even better, a
run-this-ant-file-in-a-separate-name-space-while-exporting-these-variables
mechanism?

Thanks,
Jason


Conor MacNeill writes:
> Checkout the uptodate task.
> 
> ----- Original Message ----- 
> From: "Jason Crickmer" <jc...@hire.com>
> To: <an...@jakarta.apache.org>
> Sent: Wednesday, May 02, 2001 11:15 PM
> Subject: basic file dependency
> 
> 
> > I am new to the list, so please pardon me if this question has been
> > asked before...
> > 
> > We have moved from Make to Ant, but there are some lingering issues
> > that I need to try to resolve.  The most important is, how does file
> > dependency work?
> > 
> > Take this Makefile for example:
> > 
> > .PHONY: mytarget
> > 
> > CP_XERCES=/opt/ApacheGroup/xerces-1.2.3/xerces.jar
> > 
> > mytarget: ../rel/etc/product.conf
> > 
> > ../rel/etc/product.conf: Makefile etc/product.conf
> > perl -p -e 's(_CP_XERCES_)(${CP_XERCES});' etc/product.conf > $@
> > 
> > 
> > So, when run, if Makefile OR etc/product.conf is newer than
> > ../rel/etc/product.conf, then the Perl command will be run.  If not,
> > nothing happens.
> > 
> > The only way I see to do this in Ant would be to create a new variable
> > and some how set it to true or false depending on the file age
> > compared to its source.  But, the only thing I have found based on
> > modification times is the "copy" task.
> > 
> > Any assistance is appreciated!
> > 
> > Thanks,
> > Jason
> > 

Re: basic file dependency

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Checkout the uptodate task.

----- Original Message ----- 
From: "Jason Crickmer" <jc...@hire.com>
To: <an...@jakarta.apache.org>
Sent: Wednesday, May 02, 2001 11:15 PM
Subject: basic file dependency


> I am new to the list, so please pardon me if this question has been
> asked before...
> 
> We have moved from Make to Ant, but there are some lingering issues
> that I need to try to resolve.  The most important is, how does file
> dependency work?
> 
> Take this Makefile for example:
> 
> .PHONY: mytarget
> 
> CP_XERCES=/opt/ApacheGroup/xerces-1.2.3/xerces.jar
> 
> mytarget: ../rel/etc/product.conf
> 
> ../rel/etc/product.conf: Makefile etc/product.conf
> perl -p -e 's(_CP_XERCES_)(${CP_XERCES});' etc/product.conf > $@
> 
> 
> So, when run, if Makefile OR etc/product.conf is newer than
> ../rel/etc/product.conf, then the Perl command will be run.  If not,
> nothing happens.
> 
> The only way I see to do this in Ant would be to create a new variable
> and some how set it to true or false depending on the file age
> compared to its source.  But, the only thing I have found based on
> modification times is the "copy" task.
> 
> Any assistance is appreciated!
> 
> Thanks,
> Jason
>