ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <>
Subject launching targets based on file dependencies?
Date Wed, 13 Mar 2002 11:45:06 GMT
Hello, fellow anters,

i'm finally getting my hands dirty with ant, and i'm having trouble with what 
is probably a simple concept:

i have a set of Java files which are generated from info in a text file. 
Using 'make' it is very simple to rebuild the java files only if the text 
file is updated. i have not yet found a way to do this using ant. i have read 
about DependSet, but says: "The dependset task compares a set of source files 
with a set of target files. If any of the source files is more recent than 
any of the target files, all of the target files are removed."

That doesn't help me at all, however. Well, perhaps a little bit. What i need 
to do is regenerate the .java files if the txt file is newer. i can envision 
using DependSet to delete the java files if they are out of date, then 
regenerating the files, but i cannot see a way (using "pure ant") to rebuild 
the java files ONLY if the text file is newer. The only way i can see doing 
this is using shell commands. Sure, i can run those from ant, but the whole 
point of ant is to not use shell code. (i've already got to run shell code to 
regenerate the files, though.)

The major problem here is that if i regenerate the java files on each build, 
the build takes more than 20 minutes longer than it does if the java files 
are not regenerated, so i cannot be sloppy and simply force a full build each 
time. (For the curious, the generated classes are a database layer, which 
almost everything in our 1700-class tree depends on, and Javac will force a 
recompile of almost every file if our db layer is updated.)

How does one trigger the execution of a target based on real file 
dependencies (i.e., make-style, where deps are assumed to be files, as 
opposed to ant-style, where deps are logical targets)?

Any tips would be greatly appreciated,

----- stephan
Generic Universal Computer Guy -
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"Unix: the shell is your oyster."

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message