Well, the builds that I do at my day job take a couple of minutes and I hate wating for build to complete. So i decided to add a simple voice notification mechanism at the end of the build so that I can go back to poor dos prompt.
I was left with three options:
1. Using optional ant task Sound.
Using sound task is little boring since you need the audio files for what your build process want to say to you. Also this requires modifying the original build which could be annoying for other team members who don't prefer the sound notification.
2. Writing a custom ant task using FreeTTS.
Writing a custom ant task would help me relearn how to write custom ant task as it has been 2 years since i wrote a custom ant task. But the problem is this also requires modifying the original build which could be annoying for other team members who don't prefer the sound notification.
3. Writing a custom logger.
Well this option probably is simplest and doesn't require any change to regular build file. So this works great for me.
Its really amazing how simeple this task is using FreeTTS and Ant. Write a simple logger extending DefaultLogger. Extending DefaultLogger helps because you only need to listen to events that you want to add sound to. Here is my code for providing sound to build complete event:
For using the logger copile this code into a jar file of its own. You can download my jar file. copy this jar file into lib directory of your ANT_HOME. Now you need to copy FreeTTS libraries (all jars under freetts\lib directory) to ANT_HOME\lib directory. But ant 1.6 and FreeTTS 1.2Beta2, this throws a unexpected Exception:
at java.lang.System.arraycopy(Native Method)
A simple way to get around this is by copying FreeTTS libraries to JRE\lib\ext directory. Now to use this new logger, just use the command:
ant -logger org.js.build.FreeTTSLogger