On Friday 15 March 2002 16:28 pm, Craig Moffitt wrote:
> Hello,
>
> Is there a way to fail on a cvs task command similar to the javac task's
> "failonerror"?

What i've done to get around this is created a custom target which calls a 
perl script which generates a shell script which runs CVS, calling exit if a 
CVS command returns !0.
<target name="cvsupdate" depends="init" unless="cvs.noupdates">
        <echo>Importing CVS mail and generating update commands...</echo>
        <exec dir="${build.topdir}" 
                executable="perl" 
                failonerror="true"
                output="${build.cvs.updatescript}">
                <arg line="${build.topdir}/build/mail2cvsupdate ${build.cvs.mail}"/>
        </exec>
        <exec dir="${build.topdir}" 
                executable="sh" 
                failonerror="true">
                <arg value="${build.cvs.updatescript}"/>
        </exec>
   </target>

this target alone won't help you much, since it uses some custom tools, but 
you should be able to get the jist of it:

a) call perl script. That generates a shell script which has lines like this:
...
echo cvs up -r 1.3 webapps/backoffice/newsletter2/WEB-INF/conf/laf.properties
cvs up -r 1.3 webapps/backoffice/newsletter2/WEB-INF/conf/laf.properties || 
exit $?
...
(excuse the word-wrapping there)

b) call the shell script.

The ant output then goes like this:
stephan@cheyenne:~/cvs/einsurance> ant cvsupdate
Buildfile: build.xml

init:
     [echo] Starting einsurance.de build process
...
cvsupdate:
     [echo] Importing CVS mail and generating update commands...
     [exec] cvs up -r 1.3 
webapps/backoffice/newsletter2/WEB-INF/conf/laf.properties
     [exec] cvs up -r 1.3 
webapps/backoffice/newsletter2/WEB-INF/conf/HelpText.properties
     [exec] cvs up -r 1.3 
webapps/backoffice/newsletter2/WEB-INF/conf/exceptionhandler.properties
     [exec] cvs up -r 1.3 
webapps/backoffice/newsletter2/WEB-INF/conf/emailer.properties.production
...

If any of the cvs update lines fails then ant will croak. The whole reason 
for the perl script, by the way, is that it reads in CVS mails and converts 
them into cvs update commands. So our developers fwd me their CVS-generated 
mails and the build process updates only those files to exactly the revision 
the developer requested.


----- stephan
Generic Universal Computer Guy
[EMAIL PROTECTED] - http://www.einsurance.de
Office: +49 (89) �552 92 862 Handy: �+49 (179) 211 97 67
"I ain't gen'rally given to physicality of that nature but it saves
a lot of arguing." -- Nanny Ogg

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to