Sorry for the repeat, but this is baffling and looks either buggy or
ill-designed, and we really need to understand how it works... could
someone shed some light?

-----Original Message-----
From: Brown, Carlton 
Sent: Monday, August 28, 2006 6:33 PM
To: user@ant.apache.org
Subject: <apply> outputproperty not capturing output


Hi all,

Basic question:  What is the real significance of the "outputproperty"
attribute of the <apply> task?  Is this just some kind of race condition
where Ant applies the output of whichever command invocation happens to
run first?

Observation:   If I <apply> a command to more than one file, and the
command produces output for only certain files, I don't see any of the
output in the property defined by "outputproperty".   I can however see
it if I limit the <apply> fileset to only one file, (effectively making
it an <exec> and not what I'm looking for).

Situation:   I'm running an <apply> task (code below) that processes
about 48 idl files.  Since this is a crappy idl compiler that happily
returns a zero exit status when it fails, I'm forced to parse the output
to detect failures.   Since I use <apply> to apply the idlj program to
all 48 IDL files, I want to parse the output of all 48 command
invocations for a certain failure string.  So I use the "contains"
condition.   However, I notice that the output doesn't get captured in
the outputproperty if I apply to more than one file.

Some code:

        <target name="generate-netxidl" depends="init">
                <apply executable="${idl.compiler.path}"
failonerror="true" failifexecutionfails="true"
                        outputproperty="netx.idlj.output"
errorproperty="netx.idlj.error">                        
                        <arg value="-f"/>
                        <arg value="all"/>
                        <arg value="-pkgPrefix"/>
                        <arg value="idl"/>
                        <arg value="${netxidl.package.prefix}"/>
                        <arg value="-td"/>
                        <arg value="${generation.output.dir}"/>
                        <arg value="-i"/>
                        <arg value="${idl.src.path}/netx"/>
                        <arg value="-noWarn"/>
                        <srcfile/>
                <!-- If  I set the fileset below to a very specific name
instead of a wildcard, 
                the output gets assigned to netx.idlj.output and this
fails as expected.  Otherwise, it doesn't -->
                <fileset dir="${idl.src.path}/netx" includes="*.idl"/>
                </apply>
                <fail message="netx idl generation failed with this
error:${line.separator}${netx.idlj.output}">
                        <condition>
                                <and>
                                        <contains
string="${netx.idlj.output}" substring=" (line "/>
                                </and>
                        </condition>
                </fail>
        </target>

*****

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential, proprietary, and/or
privileged material. Any review, retransmission, dissemination or other
use of, or taking of any action in reliance upon this information by
persons or entities other than the intended recipient is prohibited. If
you received this in error, please contact the sender and delete the
material from all computers. GA622



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

Reply via email to