In my case, the mapping is user-defined (using a <mapper>), but always maps a single XSD file (XML schema) to a single directory where the code is going to be generated, which is assumed to contain only the generated files (thus can be deleted freely by my task).
As far as what kind of cache file you use, I quickly hacked a properties file-based scheme, with one entry per file generated, and a few specific entries. I intend to re-write the caching mechanism into a suitable class one day (probably only if I need to use it somewhere else though ;-). Your persistent Map approach is fine too. I know the <cc> task from Ant-Contrib as a proper XML-file-based cache-info mechanism to avoid reparsing C/C++ files for include-dependency info that I need to investigate (or emulate one day). See http://marc.theaimsgroup.com/?l=ant-user&m=104040017221000&w=2 for specific info about <jaxb>, and maybe have a look at the single source file posted in BugZilla under the second link. Good luck with your own task, and let me know if write a good cache class I could reuse myself ;-) Thanks, --DD -----Original Message----- From: Erik Putrycz [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 05, 2003 10:35 AM To: Ant Developers List Subject: Re: CORBA IDL uptodate checking Thanks a lot for your help ! Your Ant task concern is pretty close to my IDL task. > I think I faced the same kind of issue when I developed a <jaxb> task > (posted to BugZilla). To know whether generation or re-generation is > necessary, you do need to know which files will be generated. This usually > requires intimate knowledge of the process wrapped in a task. In my case, it > would have required parsing a schema file, and understand all various ways > the class generation was going to affect which files are generated > (renaming, etc...). This is too complex. > > I ended up looking a posteriori at what files had been generated (in an > empty dir), recording (caching) their timestamps (and sizes and checksums). > Next time, if the source document is newer than any of the files generated, > re-generation needs to happen again. But also, if the source document has > not changed, but any of the generated files had been modified, or is missing > (or if I cannot find the cache file), then re-generation is also necessary. I like this idea, but how did you figure out were to create the empty dir ? Is there somekind of temporary location used by Ant ? My current idea would be to record into a temporary location a serialized hashtable of generated files (which would be created at the first build) and then use the Ant classes to check for uptodate. Erik.