Hi list! I'm modifiying a slightly complex existing[1] build script for our J2EE web services app. I currently have two compile targets which compile class files with or without Emma modification. [aside for those who haven't seen it: Emma is a code coverage calculation tool that works by modifying the .class directly before it runs]
So, during our nightly build-and-unit-test cycle, Anthill pulls down the source from (groan) Visual SourceSafe, Ant kicks off, compiles them, instruments the classfiles, runs unit tests. It should then recompile the code, skip the Emma instrumentation, compile a WAR, and deploy to a staging server. But, because the timestamps of the java files don't change, the second <javac> invocation (without the Emma instrumentation) doesn't compile anything -- which means Emma instrumented class files end up in the WAR, which doesn't work at all. So, I tried inserting depends= to my clean task before each compile, but of course, Ant sees the multiple calls to the target and optimises them into one call! I tried looking for a "force overwrite" mode in javac, but it doesn't have one I've seen. I also tried using <touch> to change the timestamp of the source files to force the recompile, but the files are read only so that doesn't work either. Next plan is to rewrite my compile task as a macrodef so I can more directly control the flow of logic, so that I can call a clean macrodef multiple times. But that's going to entail a lot of knock-on changes elsewhere in the build system. Does anyone have any other ideas I've overlooked before I dive in and start pulling it to pieces? [1] I wrote it, but too long ago, so it might as well have been written by someone else now!