You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Shug Boabby <sh...@gmail.com> on 2008/07/26 14:21:53 UTC

Detecting modified times and exiting a target

Hi all,

I am utterly failing at attempting to implement some logic in an ant
script, I was hoping somebody here could help.

I have a target which calls an external (non-standard) compiler. The
compiler takes a directory as a parameter and recursively compiles
everything inside that folder to an output folder, but it is not smart
enough to know when it is not necessary to do the compilation. (i.e. 2
calls to the target will result in the compilation step being started
from scratch each time, despite the source folder not changing).

In this target, I need to implement the following logic:-

- get the latest modified time of the source folder (looking
recursively at all files)
- get the latest modified time of the output folder (looking
recursively at all files)
- if the output folder has been modified since the source folder, then
exit the task

Could somebody please help me implement this in ant-speak?

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


Re: Detecting modified times and exiting a target

Posted by RL...@dynamiccontrols.com.
Not what you were asking for - but:

Use cpptask from the ant-contrib project - this handles all the logic of 
compiling C and CPP, and also has some plugins for fortran. If handles all 
the dependancy analysis for the Code and if your using a standard compiler 
gcc, msvc it's all done for you.... all you have to do is configure it ;-)




André Pilz <an...@pcvisit.de> 
28/07/2008 09:08 p.m.
Please respond to
"Ant Users List" <us...@ant.apache.org>


To
Ant Users List <us...@ant.apache.org>
cc

Subject
Re: Detecting modified times and exiting a target






Already tested the <uptodate> task?

Shug Boabby schrieb:
> Hi all,
> 
> I am utterly failing at attempting to implement some logic in an ant
> script, I was hoping somebody here could help.
> 
> I have a target which calls an external (non-standard) compiler. The
> compiler takes a directory as a parameter and recursively compiles
> everything inside that folder to an output folder, but it is not smart
> enough to know when it is not necessary to do the compilation. (i.e. 2
> calls to the target will result in the compilation step being started
> from scratch each time, despite the source folder not changing).
> 
> In this target, I need to implement the following logic:-
> 
> - get the latest modified time of the source folder (looking
> recursively at all files)
> - get the latest modified time of the output folder (looking
> recursively at all files)
> - if the output folder has been modified since the source folder, then
> exit the task
> 
> Could somebody please help me implement this in ant-speak?
> 
> ---------------------------------------------------------------------
> 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



_______________________________________________________________________

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender of this email.
_______________________________________________________________________

This e-mail message has been scanned and cleared by MailMarshal at
www.dynamiccontrols.com

Re: Detecting modified times and exiting a target

Posted by André Pilz <an...@pcvisit.de>.
Already tested the <uptodate> task?

Shug Boabby schrieb:
> Hi all,
> 
> I am utterly failing at attempting to implement some logic in an ant
> script, I was hoping somebody here could help.
> 
> I have a target which calls an external (non-standard) compiler. The
> compiler takes a directory as a parameter and recursively compiles
> everything inside that folder to an output folder, but it is not smart
> enough to know when it is not necessary to do the compilation. (i.e. 2
> calls to the target will result in the compilation step being started
> from scratch each time, despite the source folder not changing).
> 
> In this target, I need to implement the following logic:-
> 
> - get the latest modified time of the source folder (looking
> recursively at all files)
> - get the latest modified time of the output folder (looking
> recursively at all files)
> - if the output folder has been modified since the source folder, then
> exit the task
> 
> Could somebody please help me implement this in ant-speak?
> 
> ---------------------------------------------------------------------
> 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