ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Modrall" <MModr...@glgroup.com>
Subject capturing exec output and massaging it
Date Fri, 18 Aug 2006 19:48:53 GMT
Hi...

 

I'm using exec to perform an svn update for the build.  I'm capturing
the output from that and looking for the revision number in it, like
below:

 

    <target name="updatesvn" depends="init">

        <exec executable="svn" outputproperty="upout"
resultproperty="upstat">

            <arg line="update -r ${svnrev}"/>

            <redirector>

                <outputfilterchain>

                    <containsregex
pattern=".*revision:*\s(\d{1,10})\.*$" replace="\1"/>

                </outputfilterchain>

            </redirector>

        </exec>

    </target>

 

My questions:

1)       Is there any way to get the equivalent of the
<redirector>/regex into another property?  In the cases where svn fails
and you don't get a revision number, I'd like to see what the original
output was.  I.e. start with ${upout} and have the result of the regex
be put in ${uprev}?  I checked ${upstat} and svn is nice enough to have
a success status even when it fails to execute...  Ugh...  I'd like to
avoid writing the output to a temp file and using a file-based filter
chain, but I didn't see any way to define that kind of a chain from
property to property.

2)       I tried to set a default value for ${upout} to indicate a
failure, but when other tasks try to look at it after this, it only has
the default initializer and not the result of this target.  Is the
result of <exec ouputproperty="upout"> target-local if the property has
been defined previously?

3)       How does one do conditionals generally?  I know <fail> lets you
do conditionals, but where else can you use them?

 

Thanks

-Mark

 
This e-mail message, and any attachments, is intended only for the use of the individual or
entity identified in the alias address of this message and may contain information that is
confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized
disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly
prohibited. If you have received this e-mail message in error, please notify the sender immediately
by reply e-mail and delete this message, and any attachments, from your system. Thank you.

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message