ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject org.apache.tools.ant.taskdefs.ExecuteOnTest.testIgnoreMissing()
Date Tue, 13 Jul 2004 10:04:14 GMT
On my machine (W2K) the apply.xml test failed.
The reason seems to be the line 350ff:

        <apply executable="echo" ignoremissing="false"
               outputproperty="ignorefalse" append="true">
            <filelist refid="xyzlist" />
        </apply>

because "echo" is not an executable on windows - it´s an instruction
for the command line interpreter. 
So I played a little with that and got a good result with

        <apply executable="cmd.exe" ignoremissing="false"
               outputproperty="ignorefalse" append="true">
            <arg line="/C echo"/>
            <filelist refid="xyzlist" />
        </apply>

so I modified the target "ignoremissing" to (see above).
Does that work on the *NIX, OS/2, VMS, .... ? What do you think?


Jan




    <target name="ignoremissing"
depends="ignoremissing.define.other,ignoremissing.define.win9x,ignoremissing
.define.windows">
        <apply.echo ignoremissing="true"  outputproperty="ignoretrue"/>
        <apply.echo ignoremissing="false" outputproperty="ignorefalse"/>

        <fail>
            <condition>
                <not>
                    <and>
                        <equals arg1="${xy}${pad}" arg2="${ignoretrue}" />
                        <equals arg1="${xyz}${pad}" arg2="${ignorefalse}" />
                    </and>
                </not>
            </condition>
        </fail>
    </target>

    <target name="ignoremissing.init">
        <filelist id="xylist" dir="${basedir}" files="x,y" />
        <filelist id="xyzlist" dir="${basedir}" files="x,y,z" />

        <touch file="x" />
        <touch file="y" />

        <condition property="pad" value="">
            <or>
                <not>
                    <os family="dos" />
                </not>
                <not>
                    <or>
                        <equals arg1="${ant.java.version}" arg2="1.1" />
                        <equals arg1="${ant.java.version}" arg2="1.2" />
                    </or>
                </not>
            </or>
        </condition>

        <condition property="pad" value=" ">
            <and>
                <os family="dos" />
                <or>
                    <equals arg1="${ant.java.version}" arg2="1.1" />
                    <equals arg1="${ant.java.version}" arg2="1.2" />
                </or>
            </and>
        </condition>

        <pathconvert property="xy" pathsep="${pad}${line.separator}">
            <path>
                <filelist refid="xylist" />
            </path>
        </pathconvert>

        <pathconvert property="xyz" pathsep="${pad}${line.separator}">
            <path>
                <filelist refid="xyzlist" />
            </path>
        </pathconvert>

        <condition property="os.windows">
            <os family="windows"/>
        </condition>
        <condition property="os.win9x">
            <or>
                <os family="win9x"/>
                <os family="dos"/>
            </or>
        </condition>
    </target>

    <target name="ignoremissing.define.windows" depends="ignoremissing.init"
if="os.windows">
        <macrodef name="apply.echo">
            <attribute name="ignoremissing"/>
            <attribute name="outputproperty"/>
            <sequential>
        	       <apply executable="cmd.exe"
ignoremissing="@{ignoremissing}"
                       outputproperty="@{outputproperty}" append="true">
                    <arg line="/C echo"/>
                    <filelist refid="xyzlist" />
                </apply>
            </sequential>
        </macrodef>
    </target>

    <target name="ignoremissing.define.win9x" depends="ignoremissing.init"
if="os.win9x">
        <macrodef name="apply.echo">
            <attribute name="ignoremissing"/>
            <attribute name="outputproperty"/>
            <sequential>
        	       <apply executable="command.com"
ignoremissing="@{ignoremissing}"
                       outputproperty="@{outputproperty}" append="true">
                    <arg line="/C echo"/>
                    <filelist refid="xyzlist" />
                </apply>
            </sequential>
        </macrodef>
    </target>

    <target name="ignoremissing.define.other" depends="ignoremissing.init">
        <macrodef name="apply.echo">
            <attribute name="ignoremissing"/>
            <attribute name="outputproperty"/>
            <sequential>
        	       <apply executable="echo"
ignoremissing="@{ignoremissing}"
                       outputproperty="@{outputproperty}" append="true">
                    <filelist refid="xyzlist" />
                </apply>
            </sequential>
        </macrodef>
    </target>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message