It would be very useful to have ability to instrument
classes transparently.
This may be done by defining new “emma” sub-task like
“setup” which will accept all necessary data like “instr”
task but it will also add listener to the Project. After that
it is possible to add listeners and handle events related to
the ends of “javac” task and instrument all files produced
by this task.
This will be useful for existing big build systems. This will
enable emma support without rewriting of big build files.
Only few lines at the beginnig of ANT build file.
In init() method of of "setup" task you may add listener
by getProject().addBuildListener(BuildListener listener). In
you build listener implementation in method
taskFinished(BuildEvent event) you may check where
task was Javac. If so you may get distdir property and
instrument all files in there. The code would be something
like that
If(event.getTask() instanceof Javac)
{
File distdir = ((Javac) event.getTask()).getDestdir();
//instrument files in distdir directory
}
Best regards and many thatnks for the exelent tool.
Artem.
Logged In: YES
user_id=1013207
This seems like a good idea. Needs to be researched further.
I'll mention this to Dilum as well, to see how this intersects
with what we are doing for the Maven plugin.