I don't know if anyone is remotely interested but I have created a bit of
common code for playing sound files as part of the Sound task in Ant.
Here's how it gets used. Within each of my build scripts, I include these
lines:
<!--=============================================================
Import common code.
==============================================================-->
<property name="import.path" value="${ant.home}\imports"/>
<import file="${import.path}\sounds.xml" description="Play appropriate
sounds depending on whether build worked or failed."/>
This code refers to a new directory, called 'imports', that I created within
the ${ant.home} directory. Within the 'imports' directory, I have the
following:
- a file called 'sounds.xml'
- a file called 'sounds.properties'
- a directory called 'Sounds'; this directory contains two directories of
its own, 'Success' and 'Failure'
- the 'Success' directory contains a variety of .wav files that denote
success in some fashion; you are free to use any files you like but I use
cartoon clips like Daffy Duck saying "Ingenuity triumphs every time!"
- the 'Failure' directory contains a variety of .wav files that denote
failure in some fashion; you are free to use any files you like but I use
cartoon clips like Homer Simpson saying "D'oh!"
This is the contents of the sounds.xml file:
---------------------------------------------------------------------------------------
<?xml version="1.0" ?>
<project name="Sounds" default="end" basedir=".">
<description>This fragment will be imported into every Ant build
script that needs to play different sounds for success or failure
of the build.
</description>
<property name="properties.path" value="${ant.home}\imports"/>
<property file="${properties.path}\sounds.properties"/>
<sound description="Play success or failure sounds, whichever is
appropriate">
<success source="${sound.success}"/>
<fail source="${sound.failure}"/>
</sound>
<target name="end" description="Do nothing."/>
</project>
---------------------------------------------------------------------------------------
This is the contents of the sounds.properties file:
----------------------------------------------------------------------------------------
#These are the success and failure sounds to be played by Ant scripts.
#
#NOTES:
# To play a specific sound file, specify the file path in full, e.g.
C:\\Windows\\Media\\sir.wav
# To play *any* sound file from a given directory, specify the directory,
e.g. C:\\Windows\\Media
# Lines beginning with # (like this one) are comments
sound.success=d:\\Ant\\apache-ant-1.6.5\\imports\\Sounds\\Success
#sound.success=d:\\Ant\\apache-ant-1.6.5\\imports\\Sounds\\Success\\sir.wav
sound.failure=d:\\Ant\\apache-ant-1.6.5\\imports\\Sounds\\Failure
#sound.failure=d:\\Ant\\apache-ant-1.6.5\\imports\\Sounds\\Failure\\ALLWRONG.wav
----------------------------------------------------------------------------------------
Whenever I install a new version of Ant, I simply copy my 'imports'
directory and all its subdirectories over to my new Ant, then modify the
values for sound.success and sound.failure in the 'sounds.properties' file
to point to the correct path. That's pretty much the only maintenance you
have to do on this and I think you'll agree that is pretty trivial.
You are free to put any .wav files you like into the 'success' and 'failure'
directories. Well-chosen sound files can entertain you and the people around
you; one of my friends howled with laughter when he heard the file that
played upon completion of one of my scripts :-)
I just thought I'd share this with the rest of the Ant community in case
anyone was inclined to try something like this themselves.
Rhino
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/204 - Release Date: 15/12/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]